namespace QMVnSoft.Invoices
{
    using QMVnSoft;
    using QMVnSoft.Controls;
    using QMVnSoft.Controls.ChildGridControls;
    using QMVnSoft.DAL;
    using System;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Windows.Forms;

    public class FormCTBHEditor : FormEditor
    {
        private SearchColumn Column1;
        private SearchColumn Column2;
        private SearchColumn Column3;
        private SearchColumn Column33;
        private SearchColumn Column4;
        private OptionColumn Column5;
        private NumericColumn Column6;
        private NumericColumn Column7;
        private SearchColumn Column8;
        private IContainer components;
        private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
        private GridDetail grdDetail;
        public GridDetail grdSubDetail;
        private LabelControl lblDesc_EN;
        private LabelControl lblDia_Chi;
        private LabelControl lblDien_Giai;
        private LabelControl lblGia_Thue;
        private LabelControl lblHan_Tt;
        private LabelControl lblLoai_Ck;
        private LabelControl lblMa_Bp;
        private LabelControl lblMa_Dt;
        private LabelControl lblMa_Hd;
        private LabelControl lblMa_Km;
        private LabelControl lblMa_Nx;
        private LabelControl lblMa_Tte;
        private LabelControl lblNgay_Ct0;
        private LabelControl lblOng_Ba;
        private LabelControl lblSo_Ct0;
        private LabelControl lblSo_Seri;
        private LabelControl lblSo_Seri0;
        private LabelControl lblThue_GTGT;
        private LabelControl lblTien_Cash;
        private LabelControl lblTTien_Nt0;
        private LabelControl lblTTien_Nt2;
        private LabelControl lblTTien_Nt3;
        private LabelControl lblTTien_Nt4;
        private LabelControl lblTTien_Nt5;
        private LabelControl lblTTien_Nt6;
        private LabelControl lblTTien_Nt8;
        private CTBHDataAccess oMethod;
        private SearchColumn searchColumn1;
        private SearchColumn searchColumn2;
        private SearchColumn searchColumn3;
        private SearchColumn searchColumn4;
        private SearchColumn searchColumn5;
        private SearchColumn searchColumn6;
        private SearchColumn searchColumn7;
        private SearchColumn searchColumn8;
        private TextControl txtDesc_EN;
        private TextControl txtDia_Chi;
        private TextControl txtDien_Giai;
        private TextOption txtGia_Thue;
        public TextDate txtHan_Tt;
        private TextOption txtLoai_Ck;
        private TextSearch txtMa_Bp;
        private TextSearch txtMa_Dt;
        private TextSearch txtMa_Hd;
        private TextSearch txtMa_Km;
        private TextSearch txtMa_Nx;
        private TextOption txtMa_Tte;
        public TextDate txtNgay_Ct0;
        private TextControl txtOng_Ba;
        public TextControl txtSo_Ct0;
        public TextControl txtSo_Seri;
        public TextControl txtSo_Seri0;
        private TextControl txtTen_Bp;
        private TextControl txtTen_Dt;
        private TextControl txtTen_Hd;
        private TextControl txtTen_Km;
        private TextControl txtTen_Nx;
        private TextNumeric txtThue_GTGT;
        private TextNumeric txtTien_Cash;
        private TextNumeric txtTTien_Nt0;
        private TextNumeric txtTTien_Nt2;
        private TextNumeric txtTTien_Nt3;
        private TextNumeric txtTTien_Nt4;
        private TextNumeric txtTTien_Nt5;
        private TextNumeric txtTTien_Nt6;
        private TextNumeric txtTTien_Nt8;
        private SearchColumn Column9;
        private DataGridViewTextBoxColumn Column10;
        private OptionColumn Column11;
        private SearchColumn Column12;
        private SearchColumn Column13;
        private SearchColumn Column14;
        private SearchColumn Column15;
        private SearchLotNumberColumn Column17;
        private DateColumn Column18;
        private NumericColumn Column19;
        private NumericColumn Column20;
        private NumericColumn Column21;
        private NumericColumn Column22;
        private NumericColumn Column23;
        private NumericColumn Column24;
        private NumericColumn Column16;
        private NumericColumn Column25;
        private NumericColumn Column26;
        private NumericColumn Column27;
        private NumericColumn Column28;
        private NumericColumn Column29;
        private NumericColumn Column30;
        private NumericColumn Column31;
        private NumericColumn Column32;
        private TextNumeric txtTy_Gia;

        public FormCTBHEditor()
        {
            this.oMethod = new CTBHDataAccess();
            this.InitializeComponent();
            this.txtMa_Tte.InputMask = AppInstance.Currencies;
            base.InputTypeTextBox = this.txtMa_Nx;
            base.DetailGridBrowser.CellEnter += new DataGridViewCellEventHandler(this.DetailGridBrowser_CellEnter);
            base.DetailGridBrowser.CellEndEdit += new DataGridViewCellEventHandler(this.DetailGridBrowser_CellEndEdit);
            base.DetailGridBrowser.CellValidating += new DataGridViewCellValidatingEventHandler(this.DetailGridBrowser_CellValidating);
            base.ResizeForm();
        }

        public FormCTBHEditor(AppInvoiceLib po_AppInvoiceLib) : base(po_AppInvoiceLib)
        {
            this.oMethod = new CTBHDataAccess();
            this.InitializeComponent();
            base.InvoiceCode = po_AppInvoiceLib.InvoiceCode;
            this.txtMa_Tte.InputMask = AppInstance.Currencies;
            base.InputTypeTextBox = this.txtMa_Nx;
            base.DetailGridBrowser.CellEnter += new DataGridViewCellEventHandler(this.DetailGridBrowser_CellEnter);
            base.DetailGridBrowser.CellEndEdit += new DataGridViewCellEventHandler(this.DetailGridBrowser_CellEndEdit);
            base.DetailGridBrowser.CellValidating += new DataGridViewCellValidatingEventHandler(this.DetailGridBrowser_CellValidating);
            base.DetailSubBrowser.CellEnter += new DataGridViewCellEventHandler(this.DetailSubBrowser_CellEnter);
            base.DetailSubBrowser.CellEndEdit += new DataGridViewCellEventHandler(this.DetailSubBrowser_CellEndEdit);
            this.SetFunctions();
            base.ResizeForm();
        }

        public FormCTBHEditor(string ps_InvoiceCode, string ps_MasterInvoiceOrder) : base(ps_InvoiceCode, ps_MasterInvoiceOrder)
        {
            this.oMethod = new CTBHDataAccess();
            this.InitializeComponent();
            base.InvoiceCode = ps_InvoiceCode;
            this.txtMa_Tte.InputMask = AppInstance.Currencies;
            base.InputTypeTextBox = this.txtMa_Nx;
            base.DetailGridBrowser.CellEnter += new DataGridViewCellEventHandler(this.DetailGridBrowser_CellEnter);
            base.DetailGridBrowser.CellEndEdit += new DataGridViewCellEventHandler(this.DetailGridBrowser_CellEndEdit);
            base.DetailGridBrowser.CellValidating += new DataGridViewCellValidatingEventHandler(this.DetailGridBrowser_CellValidating);
            this.SetFunctions();
            base.LocalMasterRow = this.oMethod.GetMasterDataRow(base.SavedMasterOrder);
            base.LocalDetailDataSet = this.oMethod.GetDetailDataSet(base.SavedMasterOrder);
            this.OnShow();
            base.ResizeForm();
        }

        private bool AddNewRow(bool pb_Inserted)
        {
            if ((base.DetailGridBrowser.CurrentRow == null) || (base.DetailGridBrowser.CurrentRow.DataBoundItem == null))
            {
                return false;
            }
            DataRow row = ((DataRowView) base.DetailGridBrowser.CurrentRow.DataBoundItem).Row;
            if (((((decimal) row["So_Luong9"]) == 0M) && (((decimal) row["So_Luong"]) == 0M)) && ((((decimal) row["Tien_Nt9"]) == 0M) && (((decimal) row["Tien9"]) == 0M)))
            {
                return false;
            }
            int num = 0;
            if (pb_Inserted)
            {
                num = (int) row["Stt_Nv"];
                foreach (DataRow row2 in base.LocalDetailTable.Rows)
                {
                    if ((row2.RowState != DataRowState.Deleted) && (((int) row2["Stt_Nv"]) > num))
                    {
                        row2["Stt_Nv"] = ((int) row2["Stt_Nv"]) + 1;
                    }
                }
            }
            else
            {
                foreach (DataRow row3 in base.LocalDetailTable.Rows)
                {
                    if ((row3.RowState != DataRowState.Deleted) && (((int) row3["Stt_Nv"]) > num))
                    {
                        num = (int) row3["Stt_Nv"];
                    }
                }
                if (((int) row["Stt_Nv"]) < num)
                {
                    return false;
                }
            }
            object obj2 = string.IsNullOrEmpty(this.txtMa_Bp.Text) ? row["Ma_Bp"] : this.txtMa_Bp.Value;
            object obj3 = string.IsNullOrEmpty(this.txtMa_Hd.Text) ? row["Ma_Hd"] : this.txtMa_Hd.Value;
            object obj4 = string.IsNullOrEmpty(this.txtMa_Km.Text) ? row["Ma_Km"] : this.txtMa_Km.Value;
            object obj5 = base.AppInvoiceParameters.AllowMultiVAT ? row["Thue_GTGT"] : this.txtThue_GTGT.NumericValue;
            object obj6 = row["Ma_Kho"];
            object obj7 = row["Thue_TTDB"];
            object obj8 = row["Chiet_Khau"];
            base.DetailGridBrowser.EndEdit();
            DataRow row4 = base.MakeDetailRow();
            int key = num + 1;
            row4["Stt_Nv"] = key;
            row4["He_So9"] = 1;
            row4["Ma_Bp"] = obj2;
            row4["Ma_Hd"] = obj3;
            row4["Ma_Km"] = obj4;
            row4["Ma_Kho"] = obj6;
            row4["So_Luong9"] = 0;
            row4["Gia_Nt9"] = 0;
            row4["Gia9"] = 0;
            row4["Tien_Nt9"] = 0;
            row4["Tien9"] = 0;
            row4["So_Luong"] = 0;
            row4["Gia_Tb_Tt"] = "C";
            row4["Gia_Nt"] = 0;
            row4["Gia"] = 0;
            row4["Tien_Nt"] = 0;
            row4["Tien"] = 0;
            row4["Gia_Nt2"] = 0;
            row4["Gia2"] = 0;
            row4["Tien_Nt2"] = 0;
            row4["Tien2"] = 0;
            row4["Thue_GTGT"] = obj5;
            row4["Tien_Nt3"] = 0;
            row4["Tien3"] = 0;
            row4["Thue_XK"] = 0;
            row4["Tien_Nt5"] = 0;
            row4["Tien5"] = 0;
            row4["Thue_TTDB"] = obj7;
            row4["Tien_Nt8"] = 0;
            row4["Tien8"] = 0;
            row4["Chiet_Khau"] = obj8;
            row4["Tien_Nt4"] = 0;
            row4["Tien4"] = 0;
            row4["Tien_Nt6"] = 0;
            row4["Tien6"] = 0;
            row4["H_Luong"] = 0;
            row4["Do_Am_PT"] = 0;
            row4["Do_Con_PT"] = 0;
            base.LocalDetailTable.Rows.Add(row4);
            BindingSource dataSource = base.DetailGridBrowser.DataSource as BindingSource;
            dataSource.Position = dataSource.Find(base.DetailOrderString, key);
            return true;
        }

        private void Calculate(int pi_Position)
        {
            DataRow row = ((DataRowView) this.grdSubDetail.CurrentRow.DataBoundItem).Row;
            this.Calculate(row, pi_Position);
        }

        private void Calculate(DataRow po_Row, int pi_Position)
        {
            if ((pi_Position == 1) && (((decimal) po_Row["So_Luong9"]) != 0M))
            {
                po_Row["Tien"] = decimal.Round(((decimal) po_Row["So_Luong"]) * ((decimal) po_Row["Gia"]), base.LCAmountDecimals);
                po_Row["Tien_Nt"] = decimal.Round(((decimal) po_Row["Tien"]) / base.ExchangeRate, base.FCAmountDecimals);
            }
            else if ((pi_Position == 2) && (((decimal) po_Row["So_Luong9"]) != 0M))
            {
                po_Row["Gia_Nt"] = decimal.Round(((decimal) po_Row["Gia"]) / base.ExchangeRate, base.LCPriceDecimals);
                po_Row["Tien"] = decimal.Round(((decimal) po_Row["So_Luong"]) * ((decimal) po_Row["Gia"]), base.LCAmountDecimals);
                po_Row["Tien_Nt"] = decimal.Round(((decimal) po_Row["Tien"]) / base.ExchangeRate, base.FCAmountDecimals);
            }
            else if (pi_Position == 3)
            {
                if (((decimal) po_Row["So_Luong9"]) == 0M)
                {
                    po_Row["Tien_Nt"] = decimal.Round(((decimal) po_Row["Tien"]) / base.ExchangeRate, base.FCAmountDecimals);
                }
                else if (((decimal) po_Row["Tien"]) == 0M)
                {
                    po_Row["Tien"] = decimal.Round(((decimal) po_Row["So_Luong"]) * ((decimal) po_Row["Gia"]), base.LCAmountDecimals);
                    po_Row["Tien_Nt"] = decimal.Round(((decimal) po_Row["Tien"]) / base.ExchangeRate, base.FCAmountDecimals);
                }
                else if (((decimal) po_Row["Gia_Nt"]) == 0M)
                {
                    po_Row["Tien_Nt"] = decimal.Round(((decimal) po_Row["Tien"]) / base.ExchangeRate, base.FCAmountDecimals);
                    po_Row["Gia"] = decimal.Round(((decimal) po_Row["Tien"]) / ((decimal) po_Row["So_Luong"]), base.LCPriceDecimals);
                    po_Row["Gia_Nt"] = decimal.Round(((decimal) po_Row["Gia"]) / base.ExchangeRate, base.LCPriceDecimals);
                }
                else
                {
                    decimal num = decimal.Round(((decimal) po_Row["So_Luong"]) * ((decimal) po_Row["Gia"]), base.LCAmountDecimals);
                    decimal num2 = (decimal) po_Row["Tien"];
                    if ((num2 < (num - base.DiffAmountRange)) || (num2 > (num + base.DiffAmountRange)))
                    {
                        po_Row["Tien_Nt"] = decimal.Round(((decimal) po_Row["Tien"]) / base.ExchangeRate, base.FCAmountDecimals);
                        po_Row["Gia"] = decimal.Round(((decimal) po_Row["Tien"]) / ((decimal) po_Row["So_Luong"]), base.LCPriceDecimals);
                        po_Row["Gia_Nt"] = decimal.Round(((decimal) po_Row["Gia"]) / base.ExchangeRate, base.LCPriceDecimals);
                    }
                    else
                    {
                        po_Row["Tien_Nt"] = decimal.Round(((decimal) po_Row["Tien"]) / base.ExchangeRate, base.FCAmountDecimals);
                    }
                }
            }
            po_Row.EndEdit();
        }

        private void Calculate2(int pi_Position, bool pb_Repeat)
        {
            DataRow row = ((DataRowView) this.grdDetail.CurrentRow.DataBoundItem).Row;
            this.Calculate2(row, pi_Position, pb_Repeat);
            this.Calculate(row, 1);
        }

        private void Calculate2(DataRow po_Row, int pi_Position, bool pb_Repeat)
        {
            if (pb_Repeat)
            {
                if (pi_Position == 1)
                {
                    po_Row["So_Luong"] = decimal.Round(((decimal) po_Row["So_Luong9"]) * ((decimal) po_Row["He_So9"]), base.QuantityDecimals);
                    if (((decimal) po_Row["So_Luong9"]) != 0M)
                    {
                        po_Row["Tien_Nt9"] = decimal.Round(((decimal) po_Row["So_Luong9"]) * ((decimal) po_Row["Gia_Nt9"]), base.FCAmountDecimals);
                        po_Row["Tien9"] = decimal.Round(((decimal) po_Row["Tien_Nt9"]) * base.ExchangeRate, base.LCAmountDecimals);
                    }
                }
                else if ((pi_Position == 2) && (((decimal) po_Row["So_Luong9"]) != 0M))
                {
                    po_Row["Gia9"] = decimal.Round(((decimal) po_Row["Gia_Nt9"]) * base.ExchangeRate, base.LCPriceDecimals);
                    po_Row["Tien_Nt9"] = decimal.Round(((decimal) po_Row["So_Luong9"]) * ((decimal) po_Row["Gia_Nt9"]), base.FCAmountDecimals);
                    po_Row["Tien9"] = decimal.Round(((decimal) po_Row["Tien_Nt9"]) * base.ExchangeRate, base.LCAmountDecimals);
                }
                else if (pi_Position == 3)
                {
                    if (((decimal) po_Row["So_Luong9"]) == 0M)
                    {
                        po_Row["Tien9"] = decimal.Round(((decimal) po_Row["Tien_Nt9"]) * base.ExchangeRate, base.LCAmountDecimals);
                    }
                    else if (((decimal) po_Row["Tien_Nt9"]) == 0M)
                    {
                        po_Row["Tien_Nt9"] = decimal.Round(((decimal) po_Row["So_Luong9"]) * ((decimal) po_Row["Gia_Nt9"]), base.FCAmountDecimals);
                        po_Row["Tien9"] = decimal.Round(((decimal) po_Row["Tien_Nt9"]) * base.ExchangeRate, base.LCAmountDecimals);
                    }
                    else if (((decimal) po_Row["Gia_Nt9"]) == 0M)
                    {
                        po_Row["Tien9"] = decimal.Round(((decimal) po_Row["Tien_Nt9"]) * base.ExchangeRate, base.LCAmountDecimals);
                        po_Row["Gia_Nt9"] = decimal.Round(((decimal) po_Row["Tien_Nt9"]) / ((decimal) po_Row["So_Luong9"]), base.FCPriceDecimals);
                        po_Row["Gia9"] = decimal.Round(((decimal) po_Row["Gia_Nt9"]) * base.ExchangeRate, base.LCPriceDecimals);
                    }
                    else
                    {
                        decimal num = decimal.Round(((decimal) po_Row["So_Luong9"]) * ((decimal) po_Row["Gia_Nt9"]), base.FCAmountDecimals);
                        if ((((decimal) po_Row["Tien_Nt9"]) < (num - base.DiffAmountRange)) || (((decimal) po_Row["Tien_Nt9"]) > (num + base.DiffAmountRange)))
                        {
                            po_Row["Tien_Nt9"] = num;
                            po_Row["Tien9"] = decimal.Round(((decimal) po_Row["Tien_Nt9"]) * base.ExchangeRate, base.LCAmountDecimals);
                            po_Row["Gia_Nt9"] = decimal.Round(((decimal) po_Row["Tien_Nt9"]) / ((decimal) po_Row["So_Luong9"]), base.FCPriceDecimals);
                            po_Row["Gia9"] = decimal.Round(((decimal) po_Row["Gia_Nt9"]) * base.ExchangeRate, base.LCPriceDecimals);
                        }
                        else
                        {
                            po_Row["Tien9"] = decimal.Round(((decimal) po_Row["Tien_Nt9"]) * base.ExchangeRate, base.LCAmountDecimals);
                        }
                    }
                }
            }
            else
            {
                if (base.LocalMasterRow["Loai_Ck"].ToString() == "1")
                {
                    po_Row["Tien_Nt2"] = po_Row["Tien_Nt9"];
                    po_Row["Tien2"] = po_Row["Tien9"];
                }
                else
                {
                    po_Row["Tien_Nt2"] = ((decimal) po_Row["Tien_Nt9"]) - ((decimal) po_Row["Tien_Nt4"]);
                    po_Row["Tien2"] = ((decimal) po_Row["Tien9"]) - ((decimal) po_Row["Tien4"]);
                }
                if (((decimal) po_Row["So_Luong9"]) != 0M)
                {
                    po_Row["Gia_Nt2"] = decimal.Round(((decimal) po_Row["Tien_Nt2"]) / ((decimal) po_Row["So_Luong"]), base.FCPriceDecimals);
                    po_Row["Gia2"] = decimal.Round(((decimal) po_Row["Gia_Nt2"]) * base.ExchangeRate, base.LCPriceDecimals);
                }
            }
            if (pb_Repeat)
            {
                this.Calculate4(po_Row, 1);
            }
            this.Calculate5(po_Row, 1);
            this.Calculate8(po_Row, 1);
            this.Calculate3(po_Row, 1);
            po_Row.EndEdit();
        }

        private void Calculate3(int pi_Position)
        {
            DataRow row = ((DataRowView) this.grdDetail.CurrentRow.DataBoundItem).Row;
            this.Calculate3(row, pi_Position);
        }

        private void Calculate3(DataRow po_Row, int pi_Position)
        {
            if (pi_Position == 1)
            {
                po_Row["Tien3"] = decimal.Round(((((decimal) po_Row["Tien2"]) + ((decimal) po_Row["Tien6"])) * ((decimal) po_Row["Thue_GTGT"])) / 100M, base.LCAmountDecimals);
                po_Row["Tien_Nt3"] = decimal.Round(((decimal) po_Row["Tien3"]) / base.ExchangeRate, base.FCAmountDecimals);
                po_Row["Tien7"] = (this.txtLoai_Ck.Text == "1") ? decimal.Round((((decimal) po_Row["Tien4"]) * ((decimal) po_Row["Thue_GTGT"])) / 10M) : 0M;
                po_Row["Tien_Nt7"] = decimal.Round(((decimal) po_Row["Tien7"]) / base.ExchangeRate, base.FCAmountDecimals);
            }
            else if (pi_Position == 2)
            {
                decimal num = 0M;
                decimal num2 = 0M;
                po_Row["Tien3"] = decimal.Round(((decimal) po_Row["Tien_Nt3"]) * base.ExchangeRate, base.LCAmountDecimals);
                foreach (DataRow row in base.LocalDetailTable.Rows)
                {
                    if (row.RowState != DataRowState.Deleted)
                    {
                        num += decimal.Round(((((decimal) row["Tien2"]) + ((decimal) row["Tien6"])) * ((decimal) row["Thue_GTGT"])) / 100M, base.LCAmountDecimals);
                        num2 += (decimal) row["Tien3"];
                    }
                }
                if ((((decimal) po_Row["Tien3"]) == 0M) || (((num2 < (num - AppInstance.VATRange)) || (num2 > (num + AppInstance.VATRange))) && (MessageBox.Show("Giá trị VAT ch\x00eanh lệch qu\x00e1 giá trị cho ph\x00e9p.\nTính lại thuế giá trị gia tăng?", AppInstance.SoftwareName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)))
                {
                    po_Row["Tien3"] = decimal.Round(((((decimal) po_Row["Tien2"]) + ((decimal) po_Row["Tien6"])) * ((decimal) po_Row["Thue_GTGT"])) / 100M, base.LCAmountDecimals);
                    po_Row["Tien_Nt3"] = decimal.Round(((decimal) po_Row["Tien3"]) / base.ExchangeRate, base.FCAmountDecimals);
                }
            }
            else if (pi_Position == 3)
            {
                foreach (DataRow row2 in base.LocalDetailTable.Rows)
                {
                    if (row2.RowState != DataRowState.Deleted)
                    {
                        row2["Thue_GTGT"] = this.txtThue_GTGT.NumericValue;
                        row2["Tien3"] = decimal.Round(((((decimal) row2["Tien2"]) + ((decimal) row2["Tien6"])) * ((decimal) row2["Thue_GTGT"])) / 100M, base.LCAmountDecimals);
                        row2["Tien_Nt3"] = decimal.Round(((decimal) row2["Tien3"]) / base.ExchangeRate, base.FCAmountDecimals);
                        row2["Tien7"] = (this.txtLoai_Ck.Text == "1") ? decimal.Round((((decimal) row2["Tien4"]) * ((decimal) row2["Thue_GTGT"])) / 10M) : 0M;
                        row2["Tien_Nt7"] = decimal.Round(((decimal) row2["Tien7"]) / base.ExchangeRate, base.FCAmountDecimals);
                    }
                }
            }
            else if (pi_Position == 4)
            {
                decimal num3 = 0M;
                decimal num4 = 0M;
                decimal num5 = 0M;
                base.LocalMasterRow["TTien3"] = decimal.Round(this.txtTTien_Nt3.NumericValue * base.ExchangeRate, base.LCAmountDecimals);
                foreach (DataRow row3 in base.LocalDetailTable.Rows)
                {
                    if (row3.RowState != DataRowState.Deleted)
                    {
                        num3 += decimal.Round(((((decimal) row3["Tien2"]) + ((decimal) row3["Tien6"])) * ((decimal) row3["Thue_GTGT"])) / 100M, base.LCAmountDecimals);
                    }
                }
                num4 = (decimal) base.LocalMasterRow["TTien3"];
                if (num4 == 0M)
                {
                    foreach (DataRow row4 in base.LocalDetailTable.Rows)
                    {
                        if (row4.RowState != DataRowState.Deleted)
                        {
                            row4["Tien3"] = decimal.Round(((((decimal) row4["Tien2"]) + ((decimal) row4["Tien6"])) * ((decimal) row4["Thue_GTGT"])) / 100M, base.LCAmountDecimals);
                            row4["Tien_Nt3"] = decimal.Round(((decimal) row4["Tien3"]) / base.ExchangeRate, base.FCAmountDecimals);
                        }
                    }
                }
                else if ((num4 < (num3 - AppInstance.VATRange)) || (num4 > (num3 + AppInstance.VATRange)))
                {
                    if (MessageBox.Show("Giá trị VAT ch\x00eanh lệch qu\x00e1 giá trị cho ph\x00e9p.\nTính lại thuế giá trị gia tăng?", AppInstance.SoftwareName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        foreach (DataRow row5 in base.LocalDetailTable.Rows)
                        {
                            if (row5.RowState != DataRowState.Deleted)
                            {
                                row5["Tien3"] = decimal.Round(((((decimal) row5["Tien2"]) + ((decimal) row5["Tien6"])) * ((decimal) row5["Thue_GTGT"])) / 100M, base.LCAmountDecimals);
                                row5["Tien_Nt3"] = decimal.Round(((decimal) row5["Tien3"]) / base.ExchangeRate, base.FCAmountDecimals);
                            }
                        }
                    }
                    else
                    {
                        foreach (DataRow row6 in base.LocalDetailTable.Rows)
                        {
                            if (row6.RowState != DataRowState.Deleted)
                            {
                                row6["Tien3"] = decimal.Round((num4 / num3) * ((decimal) row6["Tien3"]), base.LCAmountDecimals);
                                row6["Tien_Nt3"] = decimal.Round(((decimal) row6["Tien3"]) / base.ExchangeRate, base.FCAmountDecimals);
                            }
                        }
                        num3 = 0M;
                        foreach (DataRow row7 in base.LocalDetailTable.Rows)
                        {
                            if (row7.RowState != DataRowState.Deleted)
                            {
                                num3 += (decimal) row7["Tien3"];
                                if (((decimal) row7["Tien3"]) > num5)
                                {
                                    num5 = (decimal) row7["Tien3"];
                                }
                            }
                        }
                        if (num3 != num4)
                        {
                            foreach (DataRow row8 in base.LocalDetailTable.Rows)
                            {
                                if ((row8.RowState != DataRowState.Deleted) && (((decimal) row8["Tien3"]) == num5))
                                {
                                    row8["Tien3"] = decimal.Round((((decimal) row8["Tien3"]) + num4) - num3, base.LCAmountDecimals);
                                    row8["Tien_Nt3"] = decimal.Round(((decimal) row8["Tien3"]) / base.ExchangeRate, base.FCAmountDecimals);
                                    break;
                                }
                            }
                        }
                    }
                }
                else if (((num3 != 0M) && (num4 >= (num3 - AppInstance.VATRange))) && (num4 <= (num3 + AppInstance.VATRange)))
                {
                    foreach (DataRow row9 in base.LocalDetailTable.Rows)
                    {
                        if (row9.RowState != DataRowState.Deleted)
                        {
                            row9["Tien3"] = decimal.Round((num4 / num3) * ((decimal) row9["Tien3"]), base.LCAmountDecimals);
                            row9["Tien_Nt3"] = decimal.Round(((decimal) row9["Tien3"]) / base.ExchangeRate, base.FCAmountDecimals);
                        }
                    }
                    num3 = 0M;
                    foreach (DataRow row10 in base.LocalDetailTable.Rows)
                    {
                        if (row10.RowState != DataRowState.Deleted)
                        {
                            num3 += (decimal) row10["Tien3"];
                            if (((decimal) row10["Tien3"]) > num5)
                            {
                                num5 = (decimal) row10["Tien3"];
                            }
                        }
                    }
                    if (num3 != num4)
                    {
                        foreach (DataRow row11 in base.LocalDetailTable.Rows)
                        {
                            if ((row11.RowState != DataRowState.Deleted) && (((decimal) row11["Tien3"]) == num5))
                            {
                                row11["Tien3"] = decimal.Round((((decimal) row11["Tien3"]) + num4) - num3, base.LCAmountDecimals);
                                row11["Tien_Nt3"] = decimal.Round(((decimal) row11["Tien3"]) / base.ExchangeRate, base.FCAmountDecimals);
                                break;
                            }
                        }
                    }
                }
            }
            po_Row.EndEdit();
        }

        private void Calculate4(int pi_Position)
        {
            DataRow row = ((DataRowView) this.grdDetail.CurrentRow.DataBoundItem).Row;
            this.Calculate4(row, pi_Position);
        }

        private void Calculate4(DataRow po_Row, int pi_Position)
        {
            if (pi_Position == 1)
            {
                po_Row["Tien4"] = decimal.Round((((decimal) po_Row["Tien9"]) * ((decimal) po_Row["Chiet_Khau"])) / 100M, base.LCAmountDecimals);
                po_Row["Tien_Nt4"] = decimal.Round(((decimal) po_Row["Tien4"]) / base.ExchangeRate, base.FCAmountDecimals);
                this.Calculate2(po_Row, 1, false);
            }
            else if (pi_Position == 2)
            {
                decimal num = 0M;
                decimal num2 = 0M;
                po_Row["Tien4"] = decimal.Round(((decimal) po_Row["Tien_Nt4"]) * base.ExchangeRate, base.LCAmountDecimals);
                foreach (DataRow row in base.LocalDetailTable.Rows)
                {
                    if (row.RowState != DataRowState.Deleted)
                    {
                        num += decimal.Round((((decimal) row["Tien9"]) * ((decimal) row["Chiet_Khau"])) / 100M, base.LCAmountDecimals);
                        num2 += (decimal) row["Tien4"];
                    }
                }
                if ((((decimal) po_Row["Tien4"]) == 0M) || (((num2 < (num - AppInstance.DiscountRange)) || (num2 > (num + AppInstance.DiscountRange))) && (MessageBox.Show("Giá trị chiết khấu ch\x00eanh lệch qu\x00e1 giá trị cho ph\x00e9p.\nTính lại chiết khấu?", AppInstance.SoftwareName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)))
                {
                    po_Row["Tien4"] = decimal.Round((((decimal) po_Row["Tien9"]) * ((decimal) po_Row["Chiet_Khau"])) / 100M, base.LCAmountDecimals);
                    po_Row["Tien_Nt4"] = decimal.Round(((decimal) po_Row["Tien4"]) / base.ExchangeRate, base.FCAmountDecimals);
                }
            }
            else if (pi_Position == 3)
            {
                foreach (DataRow row2 in base.LocalDetailTable.Rows)
                {
                    if (row2.RowState != DataRowState.Deleted)
                    {
                        row2["Tien4"] = decimal.Round((((decimal) row2["Tien9"]) * ((decimal) row2["Chiet_Khau"])) / 100M, base.LCAmountDecimals);
                        row2["Tien_Nt4"] = decimal.Round(((decimal) row2["Tien4"]) / base.ExchangeRate, base.FCAmountDecimals);
                        this.Calculate2(row2, 1, false);
                    }
                }
            }
            else
            {
                decimal num3 = 0M;
                decimal num4 = 0M;
                decimal num5 = 0M;
                decimal num6 = 0M;
                bool flag = true;
                base.LocalMasterRow["TTien4"] = decimal.Round(this.txtTTien_Nt4.NumericValue * base.ExchangeRate, base.LCAmountDecimals);
                num4 = (decimal) base.LocalMasterRow["TTien4"];
                foreach (DataRow row3 in base.LocalDetailTable.Rows)
                {
                    if (row3.RowState != DataRowState.Deleted)
                    {
                        num3 = decimal.Round((((decimal) row3["Tien9"]) * ((decimal) row3["Chiet_Khau"])) / 100M, base.LCAmountDecimals);
                        num6 += (decimal) row3["Tien9"];
                        if (flag && (((decimal) row3["Chiet_Khau"]) != 0M))
                        {
                            flag = false;
                        }
                    }
                }
                if (num4 == 0M)
                {
                    foreach (DataRow row4 in base.LocalDetailTable.Rows)
                    {
                        if (row4.RowState != DataRowState.Deleted)
                        {
                            row4["Tien4"] = decimal.Round((((decimal) row4["Tien9"]) * ((decimal) row4["Chiet_Khau"])) / 100M, base.LCAmountDecimals);
                            row4["Tien_Nt4"] = decimal.Round(((decimal) row4["Tien4"]) / base.ExchangeRate, base.FCAmountDecimals);
                            this.Calculate2(row4, 1, false);
                        }
                    }
                }
                else if (flag)
                {
                    num3 = 0M;
                    foreach (DataRow row5 in base.LocalDetailTable.Rows)
                    {
                        if (row5.RowState != DataRowState.Deleted)
                        {
                            row5["Tien4"] = decimal.Round((((decimal) row5["Tien9"]) * num4) / num6, base.LCAmountDecimals);
                            row5["Tien_Nt4"] = decimal.Round(((decimal) row5["Tien4"]) / base.ExchangeRate, base.FCAmountDecimals);
                            num3 += (decimal) row5["Tien4"];
                            if (((decimal) row5["Tien4"]) > num5)
                            {
                                num5 = (decimal) row5["Tien4"];
                            }
                            this.Calculate2(row5, 1, false);
                        }
                    }
                    if (num3 != num4)
                    {
                        foreach (DataRow row6 in base.LocalDetailTable.Rows)
                        {
                            if ((row6.RowState != DataRowState.Deleted) && (((decimal) row6["Tien4"]) == num5))
                            {
                                row6["Tien4"] = decimal.Round((((decimal) row6["Tien4"]) + num4) - num3, base.LCAmountDecimals);
                                row6["Tien_Nt4"] = decimal.Round(((decimal) row6["Tien4"]) / base.ExchangeRate, base.FCAmountDecimals);
                                this.Calculate2(row6, 1, false);
                                break;
                            }
                        }
                    }
                }
                else if ((num4 < (num3 - AppInstance.DiscountRange)) || (num4 > (num3 + AppInstance.DiscountRange)))
                {
                    if (MessageBox.Show("Giá trị chiết khấu ch\x00eanh lệch qu\x00e1 giá trị cho ph\x00e9p.\nTính lại chiết khấu?", AppInstance.SoftwareName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        foreach (DataRow row7 in base.LocalDetailTable.Rows)
                        {
                            if (row7.RowState != DataRowState.Deleted)
                            {
                                row7["Tien4"] = decimal.Round((((decimal) row7["Tien9"]) * ((decimal) row7["Chiet_Khau"])) / 100M, base.LCAmountDecimals);
                                row7["Tien_Nt4"] = decimal.Round(((decimal) row7["Tien4"]) / base.ExchangeRate, base.FCAmountDecimals);
                                this.Calculate2(row7, 1, false);
                            }
                        }
                    }
                    else
                    {
                        foreach (DataRow row8 in base.LocalDetailTable.Rows)
                        {
                            if (row8.RowState != DataRowState.Deleted)
                            {
                                row8["Tien4"] = decimal.Round((((decimal) row8["Tien4"]) * num4) / num3, base.LCAmountDecimals);
                                row8["Tien_Nt4"] = decimal.Round(((decimal) row8["Tien4"]) / base.ExchangeRate, base.FCAmountDecimals);
                                this.Calculate2(row8, 1, false);
                            }
                        }
                        num3 = 0M;
                        foreach (DataRow row9 in base.LocalDetailTable.Rows)
                        {
                            if (row9.RowState != DataRowState.Deleted)
                            {
                                num3 += (decimal) row9["Tien4"];
                                if (((decimal) row9["Tien4"]) > num5)
                                {
                                    num5 = (decimal) row9["Tien4"];
                                }
                            }
                        }
                        if (num3 != num4)
                        {
                            foreach (DataRow row10 in base.LocalDetailTable.Rows)
                            {
                                if ((row10.RowState != DataRowState.Deleted) && (((decimal) row10["Tien4"]) == num5))
                                {
                                    row10["Tien4"] = decimal.Round((((decimal) row10["Tien4"]) + num4) - num3, base.LCAmountDecimals);
                                    row10["Tien_Nt4"] = decimal.Round(((decimal) row10["Tien4"]) / base.ExchangeRate, base.FCAmountDecimals);
                                    this.Calculate2(row10, 1, false);
                                    break;
                                }
                            }
                        }
                    }
                }
                else if (((num3 != 0M) && (num4 >= (num3 - AppInstance.DiscountRange))) && (num4 <= (num3 + AppInstance.DiscountRange)))
                {
                    foreach (DataRow row11 in base.LocalDetailTable.Rows)
                    {
                        if (row11.RowState != DataRowState.Deleted)
                        {
                            row11["Tien4"] = decimal.Round((((decimal) row11["Tien4"]) * num4) / num3, base.LCAmountDecimals);
                            row11["Tien_Nt4"] = decimal.Round(((decimal) row11["Tien4"]) / base.ExchangeRate, base.FCAmountDecimals);
                            this.Calculate2(row11, 1, false);
                        }
                    }
                    num3 = 0M;
                    foreach (DataRow row12 in base.LocalDetailTable.Rows)
                    {
                        if (row12.RowState != DataRowState.Deleted)
                        {
                            num3 += (decimal) row12["Tien4"];
                            if (((decimal) row12["Tien4"]) > num5)
                            {
                                num5 = (decimal) row12["Tien4"];
                            }
                        }
                    }
                    if (num3 != num4)
                    {
                        foreach (DataRow row13 in base.LocalDetailTable.Rows)
                        {
                            if ((row13.RowState != DataRowState.Deleted) && (((decimal) row13["Tien4"]) == num5))
                            {
                                row13["Tien4"] = decimal.Round((((decimal) row13["Tien4"]) + num4) - num3, base.LCAmountDecimals);
                                row13["Tien_Nt4"] = decimal.Round(((decimal) row13["Tien4"]) / base.ExchangeRate, base.FCAmountDecimals);
                                this.Calculate2(row13, 1, false);
                                break;
                            }
                        }
                    }
                }
            }
            po_Row.EndEdit();
        }

        private void Calculate5(int pi_Position)
        {
            DataRow row = ((DataRowView) this.grdDetail.CurrentRow.DataBoundItem).Row;
            this.Calculate5(row, pi_Position);
        }

        private void Calculate5(DataRow po_Row, int pi_Position)
        {
            if (pi_Position == 1)
            {
                po_Row["Tien5"] = decimal.Round((((decimal) po_Row["Tien2"]) * ((decimal) po_Row["Thue_XK"])) / 100M, base.LCAmountDecimals);
            }
            po_Row["Tien_Nt5"] = decimal.Round(((decimal) po_Row["Tien5"]) / base.ExchangeRate, base.FCAmountDecimals);
            po_Row.EndEdit();
        }

        private void Calculate6()
        {
            DataRow row = ((DataRowView) this.grdDetail.CurrentRow.DataBoundItem).Row;
            this.Calculate6(row);
        }

        private void Calculate6(DataRow po_Row)
        {
            po_Row["Tien6"] = decimal.Round(((decimal) po_Row["Tien_Nt6"]) * base.ExchangeRate, base.LCAmountDecimals);
            this.Calculate3(po_Row, 1);
            po_Row.EndEdit();
        }

        private void Calculate8(int pi_Position)
        {
            DataRow row = ((DataRowView) this.grdDetail.CurrentRow.DataBoundItem).Row;
            this.Calculate8(row, pi_Position);
        }

        private void Calculate8(DataRow po_Row, int pi_Position)
        {
            if (pi_Position == 1)
            {
                po_Row["Tien8"] = decimal.Round(((((decimal) po_Row["Tien2"]) + ((decimal) po_Row["Tien5"])) * ((decimal) po_Row["Thue_TTDB"])) / 100M, base.LCAmountDecimals);
            }
            po_Row["Tien_Nt8"] = decimal.Round(((decimal) po_Row["Tien8"]) / base.ExchangeRate, base.FCAmountDecimals);
        }

        private void DetailGridBrowser_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 0)
            {
                this.UpdateVtParameters();
            }
            else if (e.ColumnIndex == 2)
            {
                this.SetItemRatio();
            }
            else if (e.ColumnIndex == 12)
            {
                this.Calculate2(1, true);
                this.Sum();
            }
            else if (e.ColumnIndex == 13)
            {
                this.Calculate2(2, true);
                this.Sum();
            }
            else if (e.ColumnIndex == 14)
            {
                this.Calculate2(3, true);
                this.Sum();
            }
            else if (e.ColumnIndex == 15)
            {
                this.Calculate5(1);
                this.Sum();
            }
            else if (e.ColumnIndex == 0x10)
            {
                this.Calculate5(2);
                this.Sum();
            }
            else if (e.ColumnIndex == 0x11)
            {
                this.Calculate8(1);
                this.Sum();
            }
            else if (e.ColumnIndex == 0x12)
            {
                this.Calculate8(2);
                this.Sum();
            }
            else if (e.ColumnIndex == 0x13)
            {
                this.Calculate4(1);
                this.Sum();
            }
            else if (e.ColumnIndex == 20)
            {
                this.Calculate4(2);
                this.Sum();
            }
            else if (e.ColumnIndex == 0x15)
            {
                this.Calculate6();
                this.Sum();
            }
            else if (e.ColumnIndex == 0x16)
            {
                this.Calculate3(1);
                this.Sum();
            }
            else if (e.ColumnIndex == 0x17)
            {
                this.Calculate3(2);
                this.Sum();
            }
        }

        private void DetailGridBrowser_CellEnter(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 2)
            {
                this.SetItemUnits();
            }
            else if (e.ColumnIndex == 7)
            {
                DataRow row = ((DataRowView) base.DetailGridBrowser.CurrentRow.DataBoundItem).Row;
                (base.DetailGridBrowser.CurrentCell as SearchLotNumberCell).InvoicePosted = base.LocalMasterRow["Posted"];
                (base.DetailGridBrowser.CurrentCell as SearchLotNumberCell).InvoiceDate = (DateTime) base.txtNgay_Ct.Value;
                (base.DetailGridBrowser.CurrentCell as SearchLotNumberCell).MasterKey = base.SavedMasterOrder;
                (base.DetailGridBrowser.CurrentCell as SearchLotNumberCell).DetailKey = base.SavedDetailOrder;
                (base.DetailGridBrowser.CurrentCell as SearchLotNumberCell).InventoryCode = row["Ma_Kho"];
                (base.DetailGridBrowser.CurrentCell as SearchLotNumberCell).LocalItemCode = row["Ma_Vt"];
                (base.DetailGridBrowser.CurrentCell as SearchLotNumberCell).LocalDetailTable = base.LocalDetailTable;
            }
        }

        private void DetailGridBrowser_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
        {
            if (((AppInstance.StockWarning != 0) && ((base.DetailGridBrowser.CurrentRow != null) && (base.DetailGridBrowser.CurrentRow.DataBoundItem != null))) && (e.ColumnIndex == 12))
            {
                string str = "";
                DataRow row = ((DataRowView) base.DetailGridBrowser.CurrentRow.DataBoundItem).Row;
                if (base.DetailGridBrowser.CurrentCell.IsInEditMode)
                {
                    row["So_Luong9"] = Convert.ToDecimal(string.IsNullOrEmpty(e.FormattedValue.ToString()) ? "0" : e.FormattedValue);
                    this.Calculate2(row, 1, true);
                    this.Sum();
                }
                if ((base.AppInvoiceParameters.InvoiceType == "2") && !base.AppInvoiceParameters.MakeLotQtyWarningMessage(base.LocalMasterRow["Posted"], base.SavedMasterOrder, row["Stt0"], base.txtNgay_Ct.Value, base.AppInvoiceParameters.InvoiceType, row["Ma_Kho"], row["Ma_Vt"], DBNull.Value, row["Lo_Hang"], base.LocalDetailTable, ref str))
                {
                    e.Cancel = true;
                    (base.DetailGridBrowser.CurrentCell as NumericCell).CheckMovable = false;
                    MessageBox.Show(str, AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
                else
                {
                    e.Cancel = false;
                    (base.DetailGridBrowser.CurrentCell as NumericCell).CheckMovable = true;
                    if (!base.AppInvoiceParameters.MakeQtyWarningMessage(false, base.LocalMasterRow["Posted"], base.SavedMasterOrder, row["Stt0"], base.txtNgay_Ct.Value, base.AppInvoiceParameters.InvoiceType, row["Ma_Kho"], row["Ma_Vt"], DBNull.Value, base.LocalDetailTable, ref str))
                    {
                        if (AppInstance.StockWarning == 2)
                        {
                            e.Cancel = true;
                            (base.DetailGridBrowser.CurrentCell as NumericCell).CheckMovable = false;
                        }
                        else
                        {
                            e.Cancel = false;
                            (base.DetailGridBrowser.CurrentCell as NumericCell).CheckMovable = true;
                        }
                        MessageBox.Show(str, AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    }
                }
            }
        }

        private void DetailSubBrowser_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 14)
            {
                this.Calculate(2);
            }
            else if (e.ColumnIndex == 15)
            {
                this.Calculate(3);
            }
        }

        private void DetailSubBrowser_CellEnter(object sender, DataGridViewCellEventArgs e)
        {
            DataRow row = ((DataRowView) base.DetailSubBrowser.CurrentRow.DataBoundItem).Row;
            if (e.ColumnIndex == 14)
            {
                base.DetailSubBrowser.CurrentCell.ReadOnly = row["Gia_Tb_Tt"].ToString() == "C";
            }
            else if (e.ColumnIndex == 15)
            {
                base.DetailSubBrowser.CurrentCell.ReadOnly = row["Gia_Tb_Tt"].ToString() == "C";
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void grdDetail_CellBottomLeftLeaved(object sender, EventArgs e)
        {
            if (((base.DetailGridBrowser.Rows.Count == 1) || !string.IsNullOrEmpty(((DataRowView) base.DetailGridBrowser.CurrentRow.DataBoundItem).Row["Ma_Vt"].ToString())) || !string.IsNullOrEmpty(base.ActiveControl.Text))
            {
                (base.DetailGridBrowser as GridDetail).UserMoveNextCell = GridDetail.MoveNextType.NextCell;
            }
            else
            {
                this.txtTien_Cash.Focus();
                (base.DetailGridBrowser as GridDetail).UserMoveNextCell = GridDetail.MoveNextType.DeleteCurrentRow;
            }
        }

        private void grdDetail_CellRightLeaved(object sender, EventArgs e)
        {
            if (this.AddNewRow(false))
            {
                (base.DetailGridBrowser as GridDetail).UserMoveNextCell = GridDetail.MoveNextType.FirstCell;
            }
            else
            {
                (base.DetailGridBrowser as GridDetail).UserMoveNextCell = GridDetail.MoveNextType.FirstCellNextRow;
            }
        }

        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormCTBHEditor));
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle24 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle25 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle26 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle27 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle28 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle29 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle30 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle31 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle32 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle33 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle34 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle35 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle36 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle37 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle38 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle39 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle40 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle21 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle22 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle23 = new System.Windows.Forms.DataGridViewCellStyle();
            this.txtDesc_EN = new QMVnSoft.Controls.TextControl();
            this.txtDien_Giai = new QMVnSoft.Controls.TextControl();
            this.txtTen_Hd = new QMVnSoft.Controls.TextControl();
            this.txtTen_Bp = new QMVnSoft.Controls.TextControl();
            this.lblDesc_EN = new QMVnSoft.Controls.LabelControl();
            this.lblDien_Giai = new QMVnSoft.Controls.LabelControl();
            this.txtMa_Hd = new QMVnSoft.Controls.TextSearch();
            this.lblMa_Hd = new QMVnSoft.Controls.LabelControl();
            this.txtMa_Bp = new QMVnSoft.Controls.TextSearch();
            this.lblMa_Bp = new QMVnSoft.Controls.LabelControl();
            this.txtMa_Tte = new QMVnSoft.Controls.TextOption();
            this.txtTy_Gia = new QMVnSoft.Controls.TextNumeric();
            this.txtDia_Chi = new QMVnSoft.Controls.TextControl();
            this.txtOng_Ba = new QMVnSoft.Controls.TextControl();
            this.txtTen_Dt = new QMVnSoft.Controls.TextControl();
            this.lblMa_Tte = new QMVnSoft.Controls.LabelControl();
            this.txtMa_Dt = new QMVnSoft.Controls.TextSearch();
            this.lblDia_Chi = new QMVnSoft.Controls.LabelControl();
            this.lblOng_Ba = new QMVnSoft.Controls.LabelControl();
            this.lblMa_Dt = new QMVnSoft.Controls.LabelControl();
            this.txtHan_Tt = new QMVnSoft.Controls.TextDate();
            this.lblHan_Tt = new QMVnSoft.Controls.LabelControl();
            this.txtTTien_Nt0 = new QMVnSoft.Controls.TextNumeric();
            this.lblTTien_Nt0 = new QMVnSoft.Controls.LabelControl();
            this.lblMa_Km = new QMVnSoft.Controls.LabelControl();
            this.txtMa_Km = new QMVnSoft.Controls.TextSearch();
            this.txtTen_Km = new QMVnSoft.Controls.TextControl();
            this.lblMa_Nx = new QMVnSoft.Controls.LabelControl();
            this.txtMa_Nx = new QMVnSoft.Controls.TextSearch();
            this.txtTen_Nx = new QMVnSoft.Controls.TextControl();
            this.lblTien_Cash = new QMVnSoft.Controls.LabelControl();
            this.txtTien_Cash = new QMVnSoft.Controls.TextNumeric();
            this.lblTTien_Nt6 = new QMVnSoft.Controls.LabelControl();
            this.txtTTien_Nt6 = new QMVnSoft.Controls.TextNumeric();
            this.lblTTien_Nt8 = new QMVnSoft.Controls.LabelControl();
            this.txtTTien_Nt8 = new QMVnSoft.Controls.TextNumeric();
            this.lblTTien_Nt4 = new QMVnSoft.Controls.LabelControl();
            this.txtTTien_Nt4 = new QMVnSoft.Controls.TextNumeric();
            this.lblTTien_Nt2 = new QMVnSoft.Controls.LabelControl();
            this.txtTTien_Nt2 = new QMVnSoft.Controls.TextNumeric();
            this.lblTTien_Nt5 = new QMVnSoft.Controls.LabelControl();
            this.txtTTien_Nt5 = new QMVnSoft.Controls.TextNumeric();
            this.lblTTien_Nt3 = new QMVnSoft.Controls.LabelControl();
            this.txtTTien_Nt3 = new QMVnSoft.Controls.TextNumeric();
            this.lblThue_GTGT = new QMVnSoft.Controls.LabelControl();
            this.txtThue_GTGT = new QMVnSoft.Controls.TextNumeric();
            this.lblNgay_Ct0 = new QMVnSoft.Controls.LabelControl();
            this.txtNgay_Ct0 = new QMVnSoft.Controls.TextDate();
            this.lblSo_Ct0 = new QMVnSoft.Controls.LabelControl();
            this.txtSo_Ct0 = new QMVnSoft.Controls.TextControl();
            this.txtGia_Thue = new QMVnSoft.Controls.TextOption();
            this.lblGia_Thue = new QMVnSoft.Controls.LabelControl();
            this.txtSo_Seri0 = new QMVnSoft.Controls.TextControl();
            this.lblSo_Seri0 = new QMVnSoft.Controls.LabelControl();
            this.grdDetail = new QMVnSoft.Controls.GridDetail();
            this.txtSo_Seri = new QMVnSoft.Controls.TextControl();
            this.lblSo_Seri = new QMVnSoft.Controls.LabelControl();
            this.lblLoai_Ck = new QMVnSoft.Controls.LabelControl();
            this.txtLoai_Ck = new QMVnSoft.Controls.TextOption();
            this.grdSubDetail = new QMVnSoft.Controls.GridDetail();
            this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.searchColumn1 = new QMVnSoft.Controls.ChildGridControls.SearchColumn();
            this.searchColumn2 = new QMVnSoft.Controls.ChildGridControls.SearchColumn();
            this.searchColumn3 = new QMVnSoft.Controls.ChildGridControls.SearchColumn();
            this.searchColumn4 = new QMVnSoft.Controls.ChildGridControls.SearchColumn();
            this.searchColumn5 = new QMVnSoft.Controls.ChildGridControls.SearchColumn();
            this.searchColumn6 = new QMVnSoft.Controls.ChildGridControls.SearchColumn();
            this.searchColumn7 = new QMVnSoft.Controls.ChildGridControls.SearchColumn();
            this.searchColumn8 = new QMVnSoft.Controls.ChildGridControls.SearchColumn();
            this.Column1 = new QMVnSoft.Controls.ChildGridControls.SearchColumn();
            this.Column2 = new QMVnSoft.Controls.ChildGridControls.SearchColumn();
            this.Column3 = new QMVnSoft.Controls.ChildGridControls.SearchColumn();
            this.Column4 = new QMVnSoft.Controls.ChildGridControls.SearchColumn();
            this.Column5 = new QMVnSoft.Controls.ChildGridControls.OptionColumn();
            this.Column6 = new QMVnSoft.Controls.ChildGridControls.NumericColumn();
            this.Column7 = new QMVnSoft.Controls.ChildGridControls.NumericColumn();
            this.Column8 = new QMVnSoft.Controls.ChildGridControls.SearchColumn();
            this.Column33 = new QMVnSoft.Controls.ChildGridControls.SearchColumn();
            this.Column9 = new QMVnSoft.Controls.ChildGridControls.SearchColumn();
            this.Column10 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column11 = new QMVnSoft.Controls.ChildGridControls.OptionColumn();
            this.Column12 = new QMVnSoft.Controls.ChildGridControls.SearchColumn();
            this.Column13 = new QMVnSoft.Controls.ChildGridControls.SearchColumn();
            this.Column14 = new QMVnSoft.Controls.ChildGridControls.SearchColumn();
            this.Column15 = new QMVnSoft.Controls.ChildGridControls.SearchColumn();
            this.Column17 = new QMVnSoft.Controls.ChildGridControls.SearchLotNumberColumn();
            this.Column18 = new QMVnSoft.Controls.ChildGridControls.DateColumn();
            this.Column19 = new QMVnSoft.Controls.ChildGridControls.NumericColumn();
            this.Column20 = new QMVnSoft.Controls.ChildGridControls.NumericColumn();
            this.Column21 = new QMVnSoft.Controls.ChildGridControls.NumericColumn();
            this.Column22 = new QMVnSoft.Controls.ChildGridControls.NumericColumn();
            this.Column23 = new QMVnSoft.Controls.ChildGridControls.NumericColumn();
            this.Column24 = new QMVnSoft.Controls.ChildGridControls.NumericColumn();
            this.Column16 = new QMVnSoft.Controls.ChildGridControls.NumericColumn();
            this.Column25 = new QMVnSoft.Controls.ChildGridControls.NumericColumn();
            this.Column26 = new QMVnSoft.Controls.ChildGridControls.NumericColumn();
            this.Column27 = new QMVnSoft.Controls.ChildGridControls.NumericColumn();
            this.Column28 = new QMVnSoft.Controls.ChildGridControls.NumericColumn();
            this.Column29 = new QMVnSoft.Controls.ChildGridControls.NumericColumn();
            this.Column30 = new QMVnSoft.Controls.ChildGridControls.NumericColumn();
            this.Column31 = new QMVnSoft.Controls.ChildGridControls.NumericColumn();
            this.Column32 = new QMVnSoft.Controls.ChildGridControls.NumericColumn();
            ((System.ComponentModel.ISupportInitialize)(this.grdDetail)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.grdSubDetail)).BeginInit();
            this.SuspendLayout();
            // 
            // lblPhan_Loai
            // 
            this.lblPhan_Loai.Location = new System.Drawing.Point(12, 497);
            // 
            // txtMa_Loai1
            // 
            this.txtMa_Loai1.Location = new System.Drawing.Point(99, 494);
            this.txtMa_Loai1.TabIndex = 32;
            // 
            // txtMa_Loai2
            // 
            this.txtMa_Loai2.Location = new System.Drawing.Point(327, 494);
            this.txtMa_Loai2.TabIndex = 33;
            // 
            // txtMa_Loai3
            // 
            this.txtMa_Loai3.Location = new System.Drawing.Point(555, 494);
            this.txtMa_Loai3.TabIndex = 34;
            // 
            // txtNgay_Ct
            // 
            this.txtNgay_Ct.TabIndex = 1;
            // 
            // txtNgay_Ps
            // 
            this.txtNgay_Ps.TabIndex = 0;
            // 
            // txtSo_Ct
            // 
            this.txtSo_Ct.TabIndex = 2;
            // 
            // txtDesc_EN
            // 
            this.txtDesc_EN.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.txtDesc_EN.CheckTextSearched = false;
            this.txtDesc_EN.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtDesc_EN.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtDesc_EN.Location = new System.Drawing.Point(487, 158);
            this.txtDesc_EN.MaxLength = 254;
            this.txtDesc_EN.Name = "txtDesc_EN";
            this.txtDesc_EN.OldValue = null;
            this.txtDesc_EN.Size = new System.Drawing.Size(295, 20);
            this.txtDesc_EN.TabIndex = 12;
            this.txtDesc_EN.UserTextLength = QMVnSoft.AppInstance.TextControlLength.InvoiceDescription;
            this.txtDesc_EN.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtDesc_EN.Value = ((object)(resources.GetObject("txtDesc_EN.Value")));
            // 
            // txtDien_Giai
            // 
            this.txtDien_Giai.CheckTextSearched = false;
            this.txtDien_Giai.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtDien_Giai.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtDien_Giai.Location = new System.Drawing.Point(99, 158);
            this.txtDien_Giai.MaxLength = 254;
            this.txtDien_Giai.Name = "txtDien_Giai";
            this.txtDien_Giai.OldValue = null;
            this.txtDien_Giai.Size = new System.Drawing.Size(296, 20);
            this.txtDien_Giai.TabIndex = 11;
            this.txtDien_Giai.UserTextLength = QMVnSoft.AppInstance.TextControlLength.InvoiceDescription;
            this.txtDien_Giai.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtDien_Giai.Value = ((object)(resources.GetObject("txtDien_Giai.Value")));
            // 
            // txtTen_Hd
            // 
            this.txtTen_Hd.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_Hd.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(194)))), ((int)(((byte)(217)))), ((int)(((byte)(247)))));
            this.txtTen_Hd.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_Hd.CheckTextSearched = false;
            this.txtTen_Hd.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_Hd.Enabled = false;
            this.txtTen_Hd.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_Hd.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_Hd.Location = new System.Drawing.Point(223, 98);
            this.txtTen_Hd.Name = "txtTen_Hd";
            this.txtTen_Hd.OldValue = null;
            this.txtTen_Hd.Size = new System.Drawing.Size(559, 13);
            this.txtTen_Hd.TabIndex = 86;
            this.txtTen_Hd.UserTextLength = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtTen_Hd.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtTen_Hd.Value = ((object)(resources.GetObject("txtTen_Hd.Value")));
            // 
            // txtTen_Bp
            // 
            this.txtTen_Bp.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_Bp.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(194)))), ((int)(((byte)(217)))), ((int)(((byte)(247)))));
            this.txtTen_Bp.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_Bp.CheckTextSearched = false;
            this.txtTen_Bp.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_Bp.Enabled = false;
            this.txtTen_Bp.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_Bp.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_Bp.Location = new System.Drawing.Point(223, 77);
            this.txtTen_Bp.Name = "txtTen_Bp";
            this.txtTen_Bp.OldValue = null;
            this.txtTen_Bp.Size = new System.Drawing.Size(559, 13);
            this.txtTen_Bp.TabIndex = 87;
            this.txtTen_Bp.UserTextLength = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtTen_Bp.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtTen_Bp.Value = ((object)(resources.GetObject("txtTen_Bp.Value")));
            // 
            // lblDesc_EN
            // 
            this.lblDesc_EN.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.lblDesc_EN.AutoSize = true;
            this.lblDesc_EN.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblDesc_EN.Location = new System.Drawing.Point(410, 161);
            this.lblDesc_EN.Name = "lblDesc_EN";
            this.lblDesc_EN.Size = new System.Drawing.Size(71, 14);
            this.lblDesc_EN.TabIndex = 80;
            this.lblDesc_EN.Text = "Diễn giải (EN)";
            // 
            // lblDien_Giai
            // 
            this.lblDien_Giai.AutoSize = true;
            this.lblDien_Giai.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblDien_Giai.Location = new System.Drawing.Point(12, 161);
            this.lblDien_Giai.Name = "lblDien_Giai";
            this.lblDien_Giai.Size = new System.Drawing.Size(73, 14);
            this.lblDien_Giai.TabIndex = 81;
            this.lblDien_Giai.Text = "Diễn giải (VN)";
            // 
            // txtMa_Hd
            // 
            this.txtMa_Hd.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_Hd.CheckTextSearched = false;
            this.txtMa_Hd.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtMa_Hd.EmptyIsValid = true;
            this.txtMa_Hd.FieldDisplay = "Ten_Hd";
            this.txtMa_Hd.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_Hd.FoundIsValid = true;
            this.txtMa_Hd.Location = new System.Drawing.Point(99, 95);
            this.txtMa_Hd.MaxLength = 32;
            this.txtMa_Hd.Name = "txtMa_Hd";
            this.txtMa_Hd.OldValue = null;
            this.txtMa_Hd.Size = new System.Drawing.Size(118, 20);
            this.txtMa_Hd.TabIndex = 7;
            this.txtMa_Hd.TableName = "DMHD";
            this.txtMa_Hd.TextDisplay = this.txtTen_Hd;
            this.txtMa_Hd.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.txtMa_Hd.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.All;
            this.txtMa_Hd.Value = ((object)(resources.GetObject("txtMa_Hd.Value")));
            this.txtMa_Hd.Validated += new System.EventHandler(this.txtMa_Hd_Validated);
            // 
            // lblMa_Hd
            // 
            this.lblMa_Hd.AutoSize = true;
            this.lblMa_Hd.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblMa_Hd.Location = new System.Drawing.Point(12, 98);
            this.lblMa_Hd.Name = "lblMa_Hd";
            this.lblMa_Hd.Size = new System.Drawing.Size(54, 14);
            this.lblMa_Hd.TabIndex = 82;
            this.lblMa_Hd.Text = "Hợp đồng";
            // 
            // txtMa_Bp
            // 
            this.txtMa_Bp.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_Bp.CheckTextSearched = false;
            this.txtMa_Bp.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtMa_Bp.EmptyIsValid = true;
            this.txtMa_Bp.FieldDisplay = "Ten_Bp";
            this.txtMa_Bp.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_Bp.FoundIsValid = true;
            this.txtMa_Bp.Location = new System.Drawing.Point(99, 74);
            this.txtMa_Bp.MaxLength = 32;
            this.txtMa_Bp.Name = "txtMa_Bp";
            this.txtMa_Bp.OldValue = null;
            this.txtMa_Bp.Size = new System.Drawing.Size(118, 20);
            this.txtMa_Bp.TabIndex = 6;
            this.txtMa_Bp.TableName = "DMBP";
            this.txtMa_Bp.TextDisplay = this.txtTen_Bp;
            this.txtMa_Bp.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.txtMa_Bp.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.All;
            this.txtMa_Bp.Value = ((object)(resources.GetObject("txtMa_Bp.Value")));
            this.txtMa_Bp.Validated += new System.EventHandler(this.txtMa_Bp_Validated);
            // 
            // lblMa_Bp
            // 
            this.lblMa_Bp.AutoSize = true;
            this.lblMa_Bp.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblMa_Bp.Location = new System.Drawing.Point(12, 77);
            this.lblMa_Bp.Name = "lblMa_Bp";
            this.lblMa_Bp.Size = new System.Drawing.Size(47, 14);
            this.lblMa_Bp.TabIndex = 83;
            this.lblMa_Bp.Text = "Bộ phận";
            // 
            // txtMa_Tte
            // 
            this.txtMa_Tte.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.txtMa_Tte.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_Tte.CheckTextSearched = false;
            this.txtMa_Tte.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtMa_Tte.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_Tte.InputMask = "USD,VND";
            this.txtMa_Tte.Location = new System.Drawing.Point(697, 53);
            this.txtMa_Tte.Name = "txtMa_Tte";
            this.txtMa_Tte.OldValue = null;
            this.txtMa_Tte.Size = new System.Drawing.Size(28, 20);
            this.txtMa_Tte.TabIndex = 4;
            this.txtMa_Tte.Text = "USD";
            this.txtMa_Tte.UserTextLength = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtMa_Tte.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtMa_Tte.Value = "USD";
            this.txtMa_Tte.Validated += new System.EventHandler(this.txtMa_Tte_Validated);
            // 
            // txtTy_Gia
            // 
            this.txtTy_Gia.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTy_Gia.BackColor = System.Drawing.Color.White;
            this.txtTy_Gia.DisabledBackColor = System.Drawing.Color.Empty;
            this.txtTy_Gia.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTy_Gia.ForeColor = System.Drawing.Color.Black;
            this.txtTy_Gia.Location = new System.Drawing.Point(724, 53);
            this.txtTy_Gia.Name = "txtTy_Gia";
            this.txtTy_Gia.NumericValue = new decimal(new int[] {
            0,
            0,
            0,
            0});
            this.txtTy_Gia.OldValue = null;
            this.txtTy_Gia.Size = new System.Drawing.Size(58, 20);
            this.txtTy_Gia.TabIndex = 5;
            this.txtTy_Gia.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            this.txtTy_Gia.UserTextNumericFormat = QMVnSoft.AppInstance.TextNumericFormat.ExchangeRate;
            this.txtTy_Gia.Value = ((object)(resources.GetObject("txtTy_Gia.Value")));
            this.txtTy_Gia.Validated += new System.EventHandler(this.txtTy_Gia_Validated);
            // 
            // txtDia_Chi
            // 
            this.txtDia_Chi.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.txtDia_Chi.CheckTextSearched = false;
            this.txtDia_Chi.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtDia_Chi.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtDia_Chi.Location = new System.Drawing.Point(487, 137);
            this.txtDia_Chi.MaxLength = 128;
            this.txtDia_Chi.Name = "txtDia_Chi";
            this.txtDia_Chi.OldValue = null;
            this.txtDia_Chi.Size = new System.Drawing.Size(295, 20);
            this.txtDia_Chi.TabIndex = 10;
            this.txtDia_Chi.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemDescription;
            this.txtDia_Chi.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtDia_Chi.Value = ((object)(resources.GetObject("txtDia_Chi.Value")));
            // 
            // txtOng_Ba
            // 
            this.txtOng_Ba.CheckTextSearched = false;
            this.txtOng_Ba.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtOng_Ba.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtOng_Ba.Location = new System.Drawing.Point(99, 137);
            this.txtOng_Ba.MaxLength = 128;
            this.txtOng_Ba.Name = "txtOng_Ba";
            this.txtOng_Ba.OldValue = null;
            this.txtOng_Ba.Size = new System.Drawing.Size(296, 20);
            this.txtOng_Ba.TabIndex = 9;
            this.txtOng_Ba.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemDescription;
            this.txtOng_Ba.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtOng_Ba.Value = ((object)(resources.GetObject("txtOng_Ba.Value")));
            // 
            // txtTen_Dt
            // 
            this.txtTen_Dt.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_Dt.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(194)))), ((int)(((byte)(217)))), ((int)(((byte)(247)))));
            this.txtTen_Dt.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_Dt.CheckTextSearched = false;
            this.txtTen_Dt.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_Dt.Enabled = false;
            this.txtTen_Dt.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_Dt.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_Dt.Location = new System.Drawing.Point(223, 119);
            this.txtTen_Dt.Name = "txtTen_Dt";
            this.txtTen_Dt.OldValue = null;
            this.txtTen_Dt.Size = new System.Drawing.Size(559, 13);
            this.txtTen_Dt.TabIndex = 97;
            this.txtTen_Dt.UserTextLength = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtTen_Dt.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtTen_Dt.Value = ((object)(resources.GetObject("txtTen_Dt.Value")));
            // 
            // lblMa_Tte
            // 
            this.lblMa_Tte.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.lblMa_Tte.AutoSize = true;
            this.lblMa_Tte.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblMa_Tte.Location = new System.Drawing.Point(652, 56);
            this.lblMa_Tte.Name = "lblMa_Tte";
            this.lblMa_Tte.Size = new System.Drawing.Size(39, 14);
            this.lblMa_Tte.TabIndex = 93;
            this.lblMa_Tte.Text = "Tiền tệ";
            // 
            // txtMa_Dt
            // 
            this.txtMa_Dt.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_Dt.CheckTextSearched = false;
            this.txtMa_Dt.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtMa_Dt.FieldDisplay = "Ten_Dt";
            this.txtMa_Dt.FirstFilter = "Is_Stop = \'1\'";
            this.txtMa_Dt.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_Dt.Location = new System.Drawing.Point(99, 116);
            this.txtMa_Dt.MaxLength = 32;
            this.txtMa_Dt.Name = "txtMa_Dt";
            this.txtMa_Dt.OldValue = null;
            this.txtMa_Dt.Size = new System.Drawing.Size(118, 20);
            this.txtMa_Dt.TabIndex = 8;
            this.txtMa_Dt.TableName = "DMDT";
            this.txtMa_Dt.TextDisplay = this.txtTen_Dt;
            this.txtMa_Dt.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.txtMa_Dt.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.All;
            this.txtMa_Dt.Value = ((object)(resources.GetObject("txtMa_Dt.Value")));
            this.txtMa_Dt.Validated += new System.EventHandler(this.txtMa_Dt_Validated);
            this.txtMa_Dt.Enter += new System.EventHandler(this.txtMa_Dt_Enter);
            // 
            // lblDia_Chi
            // 
            this.lblDia_Chi.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.lblDia_Chi.AutoSize = true;
            this.lblDia_Chi.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblDia_Chi.Location = new System.Drawing.Point(441, 140);
            this.lblDia_Chi.Name = "lblDia_Chi";
            this.lblDia_Chi.Size = new System.Drawing.Size(40, 14);
            this.lblDia_Chi.TabIndex = 95;
            this.lblDia_Chi.Text = "Địa chỉ";
            // 
            // lblOng_Ba
            // 
            this.lblOng_Ba.AutoSize = true;
            this.lblOng_Ba.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblOng_Ba.Location = new System.Drawing.Point(12, 140);
            this.lblOng_Ba.Name = "lblOng_Ba";
            this.lblOng_Ba.Size = new System.Drawing.Size(42, 14);
            this.lblOng_Ba.TabIndex = 96;
            this.lblOng_Ba.Text = "Ông bà";
            // 
            // lblMa_Dt
            // 
            this.lblMa_Dt.AutoSize = true;
            this.lblMa_Dt.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblMa_Dt.Location = new System.Drawing.Point(12, 119);
            this.lblMa_Dt.Name = "lblMa_Dt";
            this.lblMa_Dt.Size = new System.Drawing.Size(55, 14);
            this.lblMa_Dt.TabIndex = 94;
            this.lblMa_Dt.Text = "Đối tượng";
            // 
            // txtHan_Tt
            // 
            this.txtHan_Tt.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.txtHan_Tt.DateTimeFormat = QMVnSoft.Controls.TextDate.DateTimeFormatType.Date;
            this.txtHan_Tt.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtHan_Tt.InsertKeyMode = System.Windows.Forms.InsertKeyMode.Overwrite;
            this.txtHan_Tt.Location = new System.Drawing.Point(99, 431);
            this.txtHan_Tt.Mask = "00/00/0000";
            this.txtHan_Tt.Name = "txtHan_Tt";
            this.txtHan_Tt.OldValue = null;
            this.txtHan_Tt.Size = new System.Drawing.Size(79, 20);
            this.txtHan_Tt.TabIndex = 20;
            this.txtHan_Tt.Value = ((object)(resources.GetObject("txtHan_Tt.Value")));
            // 
            // lblHan_Tt
            // 
            this.lblHan_Tt.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.lblHan_Tt.AutoSize = true;
            this.lblHan_Tt.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblHan_Tt.Location = new System.Drawing.Point(12, 434);
            this.lblHan_Tt.Name = "lblHan_Tt";
            this.lblHan_Tt.Size = new System.Drawing.Size(80, 14);
            this.lblHan_Tt.TabIndex = 99;
            this.lblHan_Tt.Text = "Hạn thanh toán";
            // 
            // txtTTien_Nt0
            // 
            this.txtTTien_Nt0.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTTien_Nt0.BackColor = System.Drawing.Color.White;
            this.txtTTien_Nt0.Enabled = false;
            this.txtTTien_Nt0.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTTien_Nt0.ForeColor = System.Drawing.Color.Black;
            this.txtTTien_Nt0.Location = new System.Drawing.Point(674, 473);
            this.txtTTien_Nt0.Name = "txtTTien_Nt0";
            this.txtTTien_Nt0.NumericValue = new decimal(new int[] {
            0,
            0,
            0,
            0});
            this.txtTTien_Nt0.OldValue = null;
            this.txtTTien_Nt0.Size = new System.Drawing.Size(108, 20);
            this.txtTTien_Nt0.TabIndex = 31;
            this.txtTTien_Nt0.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            this.txtTTien_Nt0.UserTextNumericFormat = QMVnSoft.AppInstance.TextNumericFormat.ForeignAmount;
            this.txtTTien_Nt0.Value = ((object)(resources.GetObject("txtTTien_Nt0.Value")));
            // 
            // lblTTien_Nt0
            // 
            this.lblTTien_Nt0.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.lblTTien_Nt0.AutoSize = true;
            this.lblTTien_Nt0.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblTTien_Nt0.Location = new System.Drawing.Point(617, 476);
            this.lblTTien_Nt0.Name = "lblTTien_Nt0";
            this.lblTTien_Nt0.Size = new System.Drawing.Size(51, 14);
            this.lblTTien_Nt0.TabIndex = 101;
            this.lblTTien_Nt0.Text = "Tổng tiền";
            // 
            // lblMa_Km
            // 
            this.lblMa_Km.AutoSize = true;
            this.lblMa_Km.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblMa_Km.Location = new System.Drawing.Point(12, 182);
            this.lblMa_Km.Name = "lblMa_Km";
            this.lblMa_Km.Size = new System.Drawing.Size(61, 14);
            this.lblMa_Km.TabIndex = 83;
            this.lblMa_Km.Text = "Khoản mục";
            // 
            // txtMa_Km
            // 
            this.txtMa_Km.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_Km.CheckTextSearched = false;
            this.txtMa_Km.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtMa_Km.EmptyIsValid = true;
            this.txtMa_Km.FieldDisplay = "Ten_Km";
            this.txtMa_Km.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_Km.FoundIsValid = true;
            this.txtMa_Km.Location = new System.Drawing.Point(99, 179);
            this.txtMa_Km.MaxLength = 32;
            this.txtMa_Km.Name = "txtMa_Km";
            this.txtMa_Km.OldValue = null;
            this.txtMa_Km.Size = new System.Drawing.Size(118, 20);
            this.txtMa_Km.TabIndex = 13;
            this.txtMa_Km.TableName = "DMKM";
            this.txtMa_Km.TextDisplay = this.txtTen_Km;
            this.txtMa_Km.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.txtMa_Km.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.All;
            this.txtMa_Km.Value = ((object)(resources.GetObject("txtMa_Km.Value")));
            this.txtMa_Km.Validated += new System.EventHandler(this.txtMa_Km_Validated);
            // 
            // txtTen_Km
            // 
            this.txtTen_Km.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_Km.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(194)))), ((int)(((byte)(217)))), ((int)(((byte)(247)))));
            this.txtTen_Km.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_Km.CheckTextSearched = false;
            this.txtTen_Km.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_Km.Enabled = false;
            this.txtTen_Km.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_Km.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_Km.Location = new System.Drawing.Point(223, 182);
            this.txtTen_Km.Name = "txtTen_Km";
            this.txtTen_Km.OldValue = null;
            this.txtTen_Km.Size = new System.Drawing.Size(559, 13);
            this.txtTen_Km.TabIndex = 87;
            this.txtTen_Km.UserTextLength = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtTen_Km.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtTen_Km.Value = ((object)(resources.GetObject("txtTen_Km.Value")));
            // 
            // lblMa_Nx
            // 
            this.lblMa_Nx.AutoSize = true;
            this.lblMa_Nx.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblMa_Nx.Location = new System.Drawing.Point(12, 203);
            this.lblMa_Nx.Name = "lblMa_Nx";
            this.lblMa_Nx.Size = new System.Drawing.Size(72, 14);
            this.lblMa_Nx.TabIndex = 82;
            this.lblMa_Nx.Text = "Mã nhập xuất";
            // 
            // txtMa_Nx
            // 
            this.txtMa_Nx.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_Nx.CheckTextSearched = false;
            this.txtMa_Nx.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtMa_Nx.FieldDisplay = "Ten_Nx";
            this.txtMa_Nx.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_Nx.FoundIsValid = true;
            this.txtMa_Nx.Location = new System.Drawing.Point(99, 200);
            this.txtMa_Nx.MaxLength = 32;
            this.txtMa_Nx.Name = "txtMa_Nx";
            this.txtMa_Nx.OldValue = null;
            this.txtMa_Nx.Size = new System.Drawing.Size(118, 20);
            this.txtMa_Nx.TabIndex = 14;
            this.txtMa_Nx.TableName = "DMNX";
            this.txtMa_Nx.TextDisplay = this.txtTen_Nx;
            this.txtMa_Nx.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.txtMa_Nx.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.All;
            this.txtMa_Nx.Value = ((object)(resources.GetObject("txtMa_Nx.Value")));
            this.txtMa_Nx.Validated += new System.EventHandler(this.txtMa_Nx_Validated);
            // 
            // txtTen_Nx
            // 
            this.txtTen_Nx.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_Nx.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(194)))), ((int)(((byte)(217)))), ((int)(((byte)(247)))));
            this.txtTen_Nx.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_Nx.CheckTextSearched = false;
            this.txtTen_Nx.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_Nx.Enabled = false;
            this.txtTen_Nx.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_Nx.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_Nx.Location = new System.Drawing.Point(223, 203);
            this.txtTen_Nx.Name = "txtTen_Nx";
            this.txtTen_Nx.OldValue = null;
            this.txtTen_Nx.Size = new System.Drawing.Size(559, 13);
            this.txtTen_Nx.TabIndex = 86;
            this.txtTen_Nx.UserTextLength = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtTen_Nx.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtTen_Nx.Value = ((object)(resources.GetObject("txtTen_Nx.Value")));
            // 
            // lblTien_Cash
            // 
            this.lblTien_Cash.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.lblTien_Cash.AutoSize = true;
            this.lblTien_Cash.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblTien_Cash.Location = new System.Drawing.Point(12, 413);
            this.lblTien_Cash.Name = "lblTien_Cash";
            this.lblTien_Cash.Size = new System.Drawing.Size(47, 14);
            this.lblTien_Cash.TabIndex = 101;
            this.lblTien_Cash.Text = "Tiền mặt";
            // 
            // txtTien_Cash
            // 
            this.txtTien_Cash.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.txtTien_Cash.BackColor = System.Drawing.Color.White;
            this.txtTien_Cash.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTien_Cash.ForeColor = System.Drawing.Color.Black;
            this.txtTien_Cash.Location = new System.Drawing.Point(99, 410);
            this.txtTien_Cash.Name = "txtTien_Cash";
            this.txtTien_Cash.NumericValue = new decimal(new int[] {
            0,
            0,
            0,
            0});
            this.txtTien_Cash.OldValue = null;
            this.txtTien_Cash.Size = new System.Drawing.Size(108, 20);
            this.txtTien_Cash.TabIndex = 17;
            this.txtTien_Cash.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            this.txtTien_Cash.UserTextNumericFormat = QMVnSoft.AppInstance.TextNumericFormat.ForeignAmount;
            this.txtTien_Cash.Value = ((object)(resources.GetObject("txtTien_Cash.Value")));
            // 
            // lblTTien_Nt6
            // 
            this.lblTTien_Nt6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.lblTTien_Nt6.AutoSize = true;
            this.lblTTien_Nt6.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblTTien_Nt6.Location = new System.Drawing.Point(629, 413);
            this.lblTTien_Nt6.Name = "lblTTien_Nt6";
            this.lblTTien_Nt6.Size = new System.Drawing.Size(39, 14);
            this.lblTTien_Nt6.TabIndex = 101;
            this.lblTTien_Nt6.Text = "Chi phí";
            // 
            // txtTTien_Nt6
            // 
            this.txtTTien_Nt6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTTien_Nt6.BackColor = System.Drawing.Color.White;
            this.txtTTien_Nt6.Enabled = false;
            this.txtTTien_Nt6.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTTien_Nt6.ForeColor = System.Drawing.Color.Black;
            this.txtTTien_Nt6.Location = new System.Drawing.Point(674, 410);
            this.txtTTien_Nt6.Name = "txtTTien_Nt6";
            this.txtTTien_Nt6.NumericValue = new decimal(new int[] {
            0,
            0,
            0,
            0});
            this.txtTTien_Nt6.OldValue = null;
            this.txtTTien_Nt6.Size = new System.Drawing.Size(108, 20);
            this.txtTTien_Nt6.TabIndex = 19;
            this.txtTTien_Nt6.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            this.txtTTien_Nt6.UserTextNumericFormat = QMVnSoft.AppInstance.TextNumericFormat.ForeignAmount;
            this.txtTTien_Nt6.Value = ((object)(resources.GetObject("txtTTien_Nt6.Value")));
            // 
            // lblTTien_Nt8
            // 
            this.lblTTien_Nt8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.lblTTien_Nt8.AutoSize = true;
            this.lblTTien_Nt8.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblTTien_Nt8.Location = new System.Drawing.Point(558, 434);
            this.lblTTien_Nt8.Name = "lblTTien_Nt8";
            this.lblTTien_Nt8.Size = new System.Drawing.Size(110, 14);
            this.lblTTien_Nt8.TabIndex = 101;
            this.lblTTien_Nt8.Text = "Thuế tiêu thụ đặc biệt";
            // 
            // txtTTien_Nt8
            // 
            this.txtTTien_Nt8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTTien_Nt8.BackColor = System.Drawing.Color.White;
            this.txtTTien_Nt8.Enabled = false;
            this.txtTTien_Nt8.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTTien_Nt8.ForeColor = System.Drawing.Color.Black;
            this.txtTTien_Nt8.Location = new System.Drawing.Point(674, 431);
            this.txtTTien_Nt8.Name = "txtTTien_Nt8";
            this.txtTTien_Nt8.NumericValue = new decimal(new int[] {
            0,
            0,
            0,
            0});
            this.txtTTien_Nt8.OldValue = null;
            this.txtTTien_Nt8.Size = new System.Drawing.Size(108, 20);
            this.txtTTien_Nt8.TabIndex = 23;
            this.txtTTien_Nt8.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            this.txtTTien_Nt8.UserTextNumericFormat = QMVnSoft.AppInstance.TextNumericFormat.ForeignAmount;
            this.txtTTien_Nt8.Value = ((object)(resources.GetObject("txtTTien_Nt8.Value")));
            // 
            // lblTTien_Nt4
            // 
            this.lblTTien_Nt4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.lblTTien_Nt4.AutoSize = true;
            this.lblTTien_Nt4.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblTTien_Nt4.Location = new System.Drawing.Point(615, 455);
            this.lblTTien_Nt4.Name = "lblTTien_Nt4";
            this.lblTTien_Nt4.Size = new System.Drawing.Size(57, 14);
            this.lblTTien_Nt4.TabIndex = 101;
            this.lblTTien_Nt4.Text = "Chiết khấu";
            // 
            // txtTTien_Nt4
            // 
            this.txtTTien_Nt4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTTien_Nt4.BackColor = System.Drawing.Color.White;
            this.txtTTien_Nt4.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTTien_Nt4.ForeColor = System.Drawing.Color.Black;
            this.txtTTien_Nt4.Location = new System.Drawing.Point(674, 452);
            this.txtTTien_Nt4.Name = "txtTTien_Nt4";
            this.txtTTien_Nt4.NumericValue = new decimal(new int[] {
            0,
            0,
            0,
            0});
            this.txtTTien_Nt4.OldValue = null;
            this.txtTTien_Nt4.Size = new System.Drawing.Size(108, 20);
            this.txtTTien_Nt4.TabIndex = 27;
            this.txtTTien_Nt4.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            this.txtTTien_Nt4.UserTextNumericFormat = QMVnSoft.AppInstance.TextNumericFormat.ForeignAmount;
            this.txtTTien_Nt4.Value = ((object)(resources.GetObject("txtTTien_Nt4.Value")));
            this.txtTTien_Nt4.Validated += new System.EventHandler(this.txtTTien_Nt4_Validated);
            // 
            // lblTTien_Nt2
            // 
            this.lblTTien_Nt2.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
            this.lblTTien_Nt2.AutoSize = true;
            this.lblTTien_Nt2.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblTTien_Nt2.Location = new System.Drawing.Point(386, 413);
            this.lblTTien_Nt2.Name = "lblTTien_Nt2";
            this.lblTTien_Nt2.Size = new System.Drawing.Size(54, 14);
            this.lblTTien_Nt2.TabIndex = 101;
            this.lblTTien_Nt2.Text = "Tiền hàng";
            // 
            // txtTTien_Nt2
            // 
            this.txtTTien_Nt2.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
            this.txtTTien_Nt2.BackColor = System.Drawing.Color.White;
            this.txtTTien_Nt2.Enabled = false;
            this.txtTTien_Nt2.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTTien_Nt2.ForeColor = System.Drawing.Color.Black;
            this.txtTTien_Nt2.Location = new System.Drawing.Point(446, 410);
            this.txtTTien_Nt2.Name = "txtTTien_Nt2";
            this.txtTTien_Nt2.NumericValue = new decimal(new int[] {
            0,
            0,
            0,
            0});
            this.txtTTien_Nt2.OldValue = null;
            this.txtTTien_Nt2.Size = new System.Drawing.Size(108, 20);
            this.txtTTien_Nt2.TabIndex = 18;
            this.txtTTien_Nt2.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            this.txtTTien_Nt2.UserTextNumericFormat = QMVnSoft.AppInstance.TextNumericFormat.ForeignAmount;
            this.txtTTien_Nt2.Value = ((object)(resources.GetObject("txtTTien_Nt2.Value")));
            // 
            // lblTTien_Nt5
            // 
            this.lblTTien_Nt5.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
            this.lblTTien_Nt5.AutoSize = true;
            this.lblTTien_Nt5.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblTTien_Nt5.Location = new System.Drawing.Point(356, 434);
            this.lblTTien_Nt5.Name = "lblTTien_Nt5";
            this.lblTTien_Nt5.Size = new System.Drawing.Size(81, 14);
            this.lblTTien_Nt5.TabIndex = 101;
            this.lblTTien_Nt5.Text = "Thuế xuất khẩu";
            // 
            // txtTTien_Nt5
            // 
            this.txtTTien_Nt5.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
            this.txtTTien_Nt5.BackColor = System.Drawing.Color.White;
            this.txtTTien_Nt5.Enabled = false;
            this.txtTTien_Nt5.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTTien_Nt5.ForeColor = System.Drawing.Color.Black;
            this.txtTTien_Nt5.Location = new System.Drawing.Point(446, 431);
            this.txtTTien_Nt5.Name = "txtTTien_Nt5";
            this.txtTTien_Nt5.NumericValue = new decimal(new int[] {
            0,
            0,
            0,
            0});
            this.txtTTien_Nt5.OldValue = null;
            this.txtTTien_Nt5.Size = new System.Drawing.Size(108, 20);
            this.txtTTien_Nt5.TabIndex = 22;
            this.txtTTien_Nt5.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            this.txtTTien_Nt5.UserTextNumericFormat = QMVnSoft.AppInstance.TextNumericFormat.ForeignAmount;
            this.txtTTien_Nt5.Value = ((object)(resources.GetObject("txtTTien_Nt5.Value")));
            // 
            // lblTTien_Nt3
            // 
            this.lblTTien_Nt3.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
            this.lblTTien_Nt3.AutoSize = true;
            this.lblTTien_Nt3.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblTTien_Nt3.Location = new System.Drawing.Point(378, 455);
            this.lblTTien_Nt3.Name = "lblTTien_Nt3";
            this.lblTTien_Nt3.Size = new System.Drawing.Size(62, 14);
            this.lblTTien_Nt3.TabIndex = 101;
            this.lblTTien_Nt3.Text = "Thuế GTGT";
            // 
            // txtTTien_Nt3
            // 
            this.txtTTien_Nt3.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
            this.txtTTien_Nt3.BackColor = System.Drawing.Color.White;
            this.txtTTien_Nt3.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTTien_Nt3.ForeColor = System.Drawing.Color.Black;
            this.txtTTien_Nt3.Location = new System.Drawing.Point(446, 452);
            this.txtTTien_Nt3.Name = "txtTTien_Nt3";
            this.txtTTien_Nt3.NumericValue = new decimal(new int[] {
            0,
            0,
            0,
            0});
            this.txtTTien_Nt3.OldValue = null;
            this.txtTTien_Nt3.Size = new System.Drawing.Size(108, 20);
            this.txtTTien_Nt3.TabIndex = 26;
            this.txtTTien_Nt3.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            this.txtTTien_Nt3.UserTextNumericFormat = QMVnSoft.AppInstance.TextNumericFormat.ForeignAmount;
            this.txtTTien_Nt3.Value = ((object)(resources.GetObject("txtTTien_Nt3.Value")));
            this.txtTTien_Nt3.Validated += new System.EventHandler(this.txtTTien_Nt3_Validated);
            // 
            // lblThue_GTGT
            // 
            this.lblThue_GTGT.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.lblThue_GTGT.AutoSize = true;
            this.lblThue_GTGT.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblThue_GTGT.Location = new System.Drawing.Point(12, 455);
            this.lblThue_GTGT.Name = "lblThue_GTGT";
            this.lblThue_GTGT.Size = new System.Drawing.Size(83, 14);
            this.lblThue_GTGT.TabIndex = 101;
            this.lblThue_GTGT.Text = "Thuế GTGT (%)";
            // 
            // txtThue_GTGT
            // 
            this.txtThue_GTGT.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.txtThue_GTGT.BackColor = System.Drawing.Color.White;
            this.txtThue_GTGT.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtThue_GTGT.ForeColor = System.Drawing.Color.Black;
            this.txtThue_GTGT.Location = new System.Drawing.Point(99, 452);
            this.txtThue_GTGT.Name = "txtThue_GTGT";
            this.txtThue_GTGT.NumericValue = new decimal(new int[] {
            0,
            0,
            0,
            0});
            this.txtThue_GTGT.OldValue = null;
            this.txtThue_GTGT.Size = new System.Drawing.Size(79, 20);
            this.txtThue_GTGT.TabIndex = 24;
            this.txtThue_GTGT.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            this.txtThue_GTGT.UserTextNumericFormat = QMVnSoft.AppInstance.TextNumericFormat.None;
            this.txtThue_GTGT.Value = ((object)(resources.GetObject("txtThue_GTGT.Value")));
            this.txtThue_GTGT.Validated += new System.EventHandler(this.txtThue_GTGT_Validated);
            // 
            // lblNgay_Ct0
            // 
            this.lblNgay_Ct0.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.lblNgay_Ct0.AutoSize = true;
            this.lblNgay_Ct0.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblNgay_Ct0.Location = new System.Drawing.Point(12, 476);
            this.lblNgay_Ct0.Name = "lblNgay_Ct0";
            this.lblNgay_Ct0.Size = new System.Drawing.Size(75, 14);
            this.lblNgay_Ct0.TabIndex = 99;
            this.lblNgay_Ct0.Text = "Ngày hóa đơn";
            // 
            // txtNgay_Ct0
            // 
            this.txtNgay_Ct0.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.txtNgay_Ct0.DateTimeFormat = QMVnSoft.Controls.TextDate.DateTimeFormatType.Date;
            this.txtNgay_Ct0.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtNgay_Ct0.InsertKeyMode = System.Windows.Forms.InsertKeyMode.Overwrite;
            this.txtNgay_Ct0.Location = new System.Drawing.Point(99, 473);
            this.txtNgay_Ct0.Mask = "00/00/0000";
            this.txtNgay_Ct0.Name = "txtNgay_Ct0";
            this.txtNgay_Ct0.OldValue = null;
            this.txtNgay_Ct0.Size = new System.Drawing.Size(79, 20);
            this.txtNgay_Ct0.TabIndex = 28;
            this.txtNgay_Ct0.Value = ((object)(resources.GetObject("txtNgay_Ct0.Value")));
            // 
            // lblSo_Ct0
            // 
            this.lblSo_Ct0.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.lblSo_Ct0.AutoSize = true;
            this.lblSo_Ct0.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblSo_Ct0.Location = new System.Drawing.Point(184, 476);
            this.lblSo_Ct0.Name = "lblSo_Ct0";
            this.lblSo_Ct0.Size = new System.Drawing.Size(63, 14);
            this.lblSo_Ct0.TabIndex = 104;
            this.lblSo_Ct0.Text = "Số hóa đơn";
            // 
            // txtSo_Ct0
            // 
            this.txtSo_Ct0.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.txtSo_Ct0.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtSo_Ct0.CheckTextSearched = false;
            this.txtSo_Ct0.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtSo_Ct0.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtSo_Ct0.Location = new System.Drawing.Point(253, 473);
            this.txtSo_Ct0.Name = "txtSo_Ct0";
            this.txtSo_Ct0.OldValue = null;
            this.txtSo_Ct0.Size = new System.Drawing.Size(90, 20);
            this.txtSo_Ct0.TabIndex = 29;
            this.txtSo_Ct0.UserTextLength = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtSo_Ct0.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtSo_Ct0.Value = ((object)(resources.GetObject("txtSo_Ct0.Value")));
            // 
            // txtGia_Thue
            // 
            this.txtGia_Thue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.txtGia_Thue.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtGia_Thue.CheckTextSearched = false;
            this.txtGia_Thue.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtGia_Thue.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtGia_Thue.InputMask = "K,C";
            this.txtGia_Thue.Location = new System.Drawing.Point(269, 452);
            this.txtGia_Thue.Name = "txtGia_Thue";
            this.txtGia_Thue.OldValue = null;
            this.txtGia_Thue.Size = new System.Drawing.Size(23, 20);
            this.txtGia_Thue.TabIndex = 25;
            this.txtGia_Thue.Text = "K";
            this.txtGia_Thue.UserTextLength = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtGia_Thue.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtGia_Thue.Value = "K";
            this.txtGia_Thue.Visible = false;
            // 
            // lblGia_Thue
            // 
            this.lblGia_Thue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.lblGia_Thue.AutoSize = true;
            this.lblGia_Thue.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblGia_Thue.Location = new System.Drawing.Point(184, 455);
            this.lblGia_Thue.Name = "lblGia_Thue";
            this.lblGia_Thue.Size = new System.Drawing.Size(62, 14);
            this.lblGia_Thue.TabIndex = 104;
            this.lblGia_Thue.Text = "Giá có thuế";
            this.lblGia_Thue.Visible = false;
            // 
            // txtSo_Seri0
            // 
            this.txtSo_Seri0.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
            this.txtSo_Seri0.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtSo_Seri0.CheckTextSearched = false;
            this.txtSo_Seri0.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtSo_Seri0.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtSo_Seri0.Location = new System.Drawing.Point(446, 473);
            this.txtSo_Seri0.Name = "txtSo_Seri0";
            this.txtSo_Seri0.OldValue = null;
            this.txtSo_Seri0.Size = new System.Drawing.Size(108, 20);
            this.txtSo_Seri0.TabIndex = 30;
            this.txtSo_Seri0.UserTextLength = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtSo_Seri0.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtSo_Seri0.Value = ((object)(resources.GetObject("txtSo_Seri0.Value")));
            // 
            // lblSo_Seri0
            // 
            this.lblSo_Seri0.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
            this.lblSo_Seri0.AutoSize = true;
            this.lblSo_Seri0.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblSo_Seri0.Location = new System.Drawing.Point(354, 476);
            this.lblSo_Seri0.Name = "lblSo_Seri0";
            this.lblSo_Seri0.Size = new System.Drawing.Size(86, 14);
            this.lblSo_Seri0.TabIndex = 104;
            this.lblSo_Seri0.Text = "Ký hiệu hóa đơn";
            // 
            // grdDetail
            // 
            this.grdDetail.AllowUserToAddRows = false;
            this.grdDetail.AllowUserToDeleteRows = false;
            this.grdDetail.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.grdDetail.CheckAutoSize = true;
            this.grdDetail.CheckColor = false;
            this.grdDetail.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.grdDetail.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.Column9,
            this.Column10,
            this.Column11,
            this.Column12,
            this.Column13,
            this.Column14,
            this.Column15,
            this.Column17,
            this.Column18,
            this.Column19,
            this.Column20,
            this.Column21,
            this.Column22,
            this.Column23,
            this.Column24,
            this.Column16,
            this.Column25,
            this.Column26,
            this.Column27,
            this.Column28,
            this.Column29,
            this.Column30,
            this.Column31,
            this.Column32});
            this.grdDetail.Font = new System.Drawing.Font("Arial", 8.25F);
            this.grdDetail.Location = new System.Drawing.Point(0, 226);
            this.grdDetail.Name = "grdDetail";
            this.grdDetail.Size = new System.Drawing.Size(794, 178);
            this.grdDetail.TabIndex = 15;
            this.grdDetail.CellRightLeaved += new System.EventHandler(this.grdDetail_CellRightLeaved);
            this.grdDetail.CellBottomLeftLeaved += new System.EventHandler(this.grdDetail_CellBottomLeftLeaved);
            // 
            // txtSo_Seri
            // 
            this.txtSo_Seri.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtSo_Seri.CheckTextSearched = false;
            this.txtSo_Seri.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtSo_Seri.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtSo_Seri.Location = new System.Drawing.Point(446, 53);
            this.txtSo_Seri.Name = "txtSo_Seri";
            this.txtSo_Seri.OldValue = null;
            this.txtSo_Seri.Size = new System.Drawing.Size(108, 20);
            this.txtSo_Seri.TabIndex = 3;
            this.txtSo_Seri.UserTextLength = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtSo_Seri.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtSo_Seri.Value = ((object)(resources.GetObject("txtSo_Seri.Value")));
            // 
            // lblSo_Seri
            // 
            this.lblSo_Seri.AutoSize = true;
            this.lblSo_Seri.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblSo_Seri.Location = new System.Drawing.Point(354, 56);
            this.lblSo_Seri.Name = "lblSo_Seri";
            this.lblSo_Seri.Size = new System.Drawing.Size(86, 14);
            this.lblSo_Seri.TabIndex = 104;
            this.lblSo_Seri.Text = "Ký hiệu hóa đơn";
            // 
            // lblLoai_Ck
            // 
            this.lblLoai_Ck.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.lblLoai_Ck.AutoSize = true;
            this.lblLoai_Ck.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblLoai_Ck.Location = new System.Drawing.Point(184, 434);
            this.lblLoai_Ck.Name = "lblLoai_Ck";
            this.lblLoai_Ck.Size = new System.Drawing.Size(79, 14);
            this.lblLoai_Ck.TabIndex = 104;
            this.lblLoai_Ck.Text = "Loại chiết khấu";
            this.lblLoai_Ck.Visible = false;
            // 
            // txtLoai_Ck
            // 
            this.txtLoai_Ck.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.txtLoai_Ck.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtLoai_Ck.CheckTextSearched = false;
            this.txtLoai_Ck.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtLoai_Ck.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtLoai_Ck.InputMask = "1,2";
            this.txtLoai_Ck.Location = new System.Drawing.Point(269, 431);
            this.txtLoai_Ck.Name = "txtLoai_Ck";
            this.txtLoai_Ck.OldValue = null;
            this.txtLoai_Ck.Size = new System.Drawing.Size(23, 20);
            this.txtLoai_Ck.TabIndex = 21;
            this.txtLoai_Ck.Text = "1";
            this.txtLoai_Ck.UserTextLength = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtLoai_Ck.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtLoai_Ck.Value = "1";
            this.txtLoai_Ck.Visible = false;
            // 
            // grdSubDetail
            // 
            this.grdSubDetail.AllowUserToAddRows = false;
            this.grdSubDetail.AllowUserToDeleteRows = false;
            this.grdSubDetail.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.grdSubDetail.CheckAutoSize = true;
            this.grdSubDetail.CheckColor = false;
            this.grdSubDetail.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.grdSubDetail.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.dataGridViewTextBoxColumn1,
            this.searchColumn1,
            this.searchColumn2,
            this.searchColumn3,
            this.searchColumn4,
            this.searchColumn5,
            this.searchColumn6,
            this.searchColumn7,
            this.searchColumn8,
            this.Column1,
            this.Column2,
            this.Column3,
            this.Column4,
            this.Column5,
            this.Column6,
            this.Column7,
            this.Column8,
            this.Column33});
            this.grdSubDetail.FirstColumnIndex = -1;
            this.grdSubDetail.Font = new System.Drawing.Font("Arial", 8.25F);
            this.grdSubDetail.Location = new System.Drawing.Point(0, 226);
            this.grdSubDetail.Name = "grdSubDetail";
            this.grdSubDetail.Size = new System.Drawing.Size(794, 178);
            this.grdSubDetail.TabIndex = 16;
            this.grdSubDetail.Visible = false;
            // 
            // dataGridViewTextBoxColumn1
            // 
            this.dataGridViewTextBoxColumn1.DataPropertyName = "Ten_Vt";
            this.dataGridViewTextBoxColumn1.HeaderText = "Tên vật tư";
            this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
            this.dataGridViewTextBoxColumn1.ReadOnly = true;
            this.dataGridViewTextBoxColumn1.Width = 135;
            // 
            // searchColumn1
            // 
            this.searchColumn1.DataPropertyName = "Tk_No2";
            dataGridViewCellStyle24.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.searchColumn1.DefaultCellStyle = dataGridViewCellStyle24;
            this.searchColumn1.DisabledForeColor = System.Drawing.Color.Blue;
            this.searchColumn1.FirstFilter = "Loai_Tk = \'C\'";
            this.searchColumn1.HeaderText = "Tk nợ";
            this.searchColumn1.Name = "searchColumn1";
            this.searchColumn1.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.searchColumn1.TableName = "DMTK";
            this.searchColumn1.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.searchColumn1.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.searchColumn1.Width = 35;
            // 
            // searchColumn2
            // 
            this.searchColumn2.DataPropertyName = "Tk_Co2";
            dataGridViewCellStyle25.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.searchColumn2.DefaultCellStyle = dataGridViewCellStyle25;
            this.searchColumn2.DisabledForeColor = System.Drawing.Color.Blue;
            this.searchColumn2.FirstFilter = "Loai_Tk = \'C\'";
            this.searchColumn2.HeaderText = "Tk có";
            this.searchColumn2.Name = "searchColumn2";
            this.searchColumn2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.searchColumn2.TableName = "DMTK";
            this.searchColumn2.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.searchColumn2.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.searchColumn2.Width = 35;
            // 
            // searchColumn3
            // 
            this.searchColumn3.DataPropertyName = "Tk_No3";
            dataGridViewCellStyle26.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.searchColumn3.DefaultCellStyle = dataGridViewCellStyle26;
            this.searchColumn3.DisabledForeColor = System.Drawing.Color.Blue;
            this.searchColumn3.FirstFilter = "Loai_Tk = \'C\'";
            this.searchColumn3.HeaderText = "Tk nợ thuế GTGT";
            this.searchColumn3.Name = "searchColumn3";
            this.searchColumn3.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.searchColumn3.TableName = "DMTK";
            this.searchColumn3.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.searchColumn3.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.searchColumn3.Width = 35;
            // 
            // searchColumn4
            // 
            this.searchColumn4.DataPropertyName = "Tk_Co3";
            dataGridViewCellStyle27.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.searchColumn4.DefaultCellStyle = dataGridViewCellStyle27;
            this.searchColumn4.DisabledForeColor = System.Drawing.Color.Blue;
            this.searchColumn4.FirstFilter = "Loai_Tk = \'C\'";
            this.searchColumn4.HeaderText = "Tk có thuế GTGT";
            this.searchColumn4.Name = "searchColumn4";
            this.searchColumn4.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.searchColumn4.TableName = "DMTK";
            this.searchColumn4.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.searchColumn4.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.searchColumn4.Width = 35;
            // 
            // searchColumn5
            // 
            this.searchColumn5.DataPropertyName = "Tk_No5";
            dataGridViewCellStyle28.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.searchColumn5.DefaultCellStyle = dataGridViewCellStyle28;
            this.searchColumn5.DisabledForeColor = System.Drawing.Color.Blue;
            this.searchColumn5.FirstFilter = "Loai_Tk = \'C\'";
            this.searchColumn5.HeaderText = "Tk nợ thuế XK";
            this.searchColumn5.Name = "searchColumn5";
            this.searchColumn5.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.searchColumn5.TableName = "DMTK";
            this.searchColumn5.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.searchColumn5.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.searchColumn5.Width = 35;
            // 
            // searchColumn6
            // 
            this.searchColumn6.DataPropertyName = "Tk_Co5";
            dataGridViewCellStyle29.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.searchColumn6.DefaultCellStyle = dataGridViewCellStyle29;
            this.searchColumn6.DisabledForeColor = System.Drawing.Color.Blue;
            this.searchColumn6.FirstFilter = "Loai_Tk = \'C\'";
            this.searchColumn6.HeaderText = "Tk có thuế XK";
            this.searchColumn6.Name = "searchColumn6";
            this.searchColumn6.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.searchColumn6.TableName = "DMTK";
            this.searchColumn6.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.searchColumn6.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.searchColumn6.Width = 35;
            // 
            // searchColumn7
            // 
            this.searchColumn7.DataPropertyName = "Tk_No8";
            dataGridViewCellStyle30.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.searchColumn7.DefaultCellStyle = dataGridViewCellStyle30;
            this.searchColumn7.DisabledForeColor = System.Drawing.Color.Blue;
            this.searchColumn7.FirstFilter = "Loai_Tk = \'C\'";
            this.searchColumn7.HeaderText = "Tk nợ thuế TTĐB";
            this.searchColumn7.Name = "searchColumn7";
            this.searchColumn7.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.searchColumn7.TableName = "DMTK";
            this.searchColumn7.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.searchColumn7.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.searchColumn7.Width = 35;
            // 
            // searchColumn8
            // 
            this.searchColumn8.DataPropertyName = "TK_Co8";
            dataGridViewCellStyle31.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.searchColumn8.DefaultCellStyle = dataGridViewCellStyle31;
            this.searchColumn8.DisabledForeColor = System.Drawing.Color.Blue;
            this.searchColumn8.FirstFilter = "Loai_Tk = \'C\'";
            this.searchColumn8.HeaderText = "Tk có thuế TTĐB";
            this.searchColumn8.Name = "searchColumn8";
            this.searchColumn8.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.searchColumn8.TableName = "DMTK";
            this.searchColumn8.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.searchColumn8.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.searchColumn8.Width = 35;
            // 
            // Column1
            // 
            this.Column1.DataPropertyName = "Tk_No4";
            dataGridViewCellStyle32.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.Column1.DefaultCellStyle = dataGridViewCellStyle32;
            this.Column1.DisabledForeColor = System.Drawing.Color.Blue;
            this.Column1.FirstFilter = "Loai_Tk = \'C\'";
            this.Column1.HeaderText = "Tk nợ chiết khấu";
            this.Column1.Name = "Column1";
            this.Column1.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column1.TableName = "DMTK";
            this.Column1.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.Column1.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.Column1.Width = 35;
            // 
            // Column2
            // 
            this.Column2.DataPropertyName = "Tk_Co4";
            dataGridViewCellStyle33.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.Column2.DefaultCellStyle = dataGridViewCellStyle33;
            this.Column2.DisabledForeColor = System.Drawing.Color.Blue;
            this.Column2.FirstFilter = "Loai_Tk = \'C\'";
            this.Column2.HeaderText = "Tk có chiết khấu";
            this.Column2.Name = "Column2";
            this.Column2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column2.TableName = "DMTK";
            this.Column2.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.Column2.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.Column2.Width = 35;
            // 
            // Column3
            // 
            this.Column3.DataPropertyName = "Tk_No6";
            dataGridViewCellStyle34.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.Column3.DefaultCellStyle = dataGridViewCellStyle34;
            this.Column3.DisabledForeColor = System.Drawing.Color.Blue;
            this.Column3.FirstFilter = "Loai_Tk = \'C\'";
            this.Column3.HeaderText = "Tk nợ chi phí";
            this.Column3.Name = "Column3";
            this.Column3.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column3.TableName = "DMTK";
            this.Column3.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.Column3.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.Column3.Width = 35;
            // 
            // Column4
            // 
            this.Column4.DataPropertyName = "Tk_Co6";
            dataGridViewCellStyle35.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.Column4.DefaultCellStyle = dataGridViewCellStyle35;
            this.Column4.DisabledForeColor = System.Drawing.Color.Blue;
            this.Column4.FirstFilter = "Loai_Tk = \'C\'";
            this.Column4.HeaderText = "Tk có chi phí";
            this.Column4.Name = "Column4";
            this.Column4.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column4.TableName = "DMTK";
            this.Column4.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.Column4.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.Column4.Width = 35;
            // 
            // Column5
            // 
            this.Column5.DataPropertyName = "Gia_Tb_Tt";
            dataGridViewCellStyle36.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.Column5.DefaultCellStyle = dataGridViewCellStyle36;
            this.Column5.DisabledForeColor = System.Drawing.Color.Blue;
            this.Column5.HeaderText = "";
            this.Column5.InputMask = "C,K";
            this.Column5.Name = "Column5";
            this.Column5.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column5.UserTextLength = QMVnSoft.AppInstance.TextControlLength.None;
            this.Column5.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.Column5.Width = 16;
            // 
            // Column6
            // 
            this.Column6.DataPropertyName = "Gia";
            dataGridViewCellStyle37.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            this.Column6.DefaultCellStyle = dataGridViewCellStyle37;
            this.Column6.HeaderText = "Giá vốn";
            this.Column6.Name = "Column6";
            this.Column6.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column6.UserTextNumericFormat = QMVnSoft.AppInstance.TextNumericFormat.LocalPrice;
            this.Column6.Width = 55;
            this.Column6.ZeroIsValid = true;
            // 
            // Column7
            // 
            this.Column7.DataPropertyName = "Tien";
            dataGridViewCellStyle38.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            this.Column7.DefaultCellStyle = dataGridViewCellStyle38;
            this.Column7.HeaderText = "Tiền vốn";
            this.Column7.Name = "Column7";
            this.Column7.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column7.UserTextNumericFormat = QMVnSoft.AppInstance.TextNumericFormat.LocalAmount;
            this.Column7.Width = 55;
            this.Column7.ZeroIsValid = true;
            // 
            // Column8
            // 
            this.Column8.DataPropertyName = "Tk_No";
            dataGridViewCellStyle39.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.Column8.DefaultCellStyle = dataGridViewCellStyle39;
            this.Column8.DisabledForeColor = System.Drawing.Color.Blue;
            this.Column8.FirstFilter = "Loai_Tk = \'C\'";
            this.Column8.HeaderText = "Tk nợ giá vốn";
            this.Column8.Name = "Column8";
            this.Column8.Resizable = System.Windows.Forms.DataGridViewTriState.True;
            this.Column8.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column8.TableName = "DMTK";
            this.Column8.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.Column8.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.Column8.Width = 35;
            // 
            // Column33
            // 
            this.Column33.DataPropertyName = "Tk_Co";
            dataGridViewCellStyle40.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.Column33.DefaultCellStyle = dataGridViewCellStyle40;
            this.Column33.DisabledForeColor = System.Drawing.Color.Blue;
            this.Column33.FirstFilter = "Loai_Tk = \'C\'";
            this.Column33.HeaderText = "Tk có giá vốn";
            this.Column33.Name = "Column33";
            this.Column33.Resizable = System.Windows.Forms.DataGridViewTriState.True;
            this.Column33.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column33.TableName = "DMTK";
            this.Column33.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.Column33.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.Column33.Width = 35;
            // 
            // Column9
            // 
            this.Column9.DataPropertyName = "Ma_Vt";
            dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.Column9.DefaultCellStyle = dataGridViewCellStyle1;
            this.Column9.DestinationFields = "Ten_Vt, Dvt";
            this.Column9.DisabledForeColor = System.Drawing.Color.Blue;
            this.Column9.EmptyIsValid = true;
            this.Column9.HeaderText = "Mã vật tư";
            this.Column9.MinimumWidth = 90;
            this.Column9.Name = "Column9";
            this.Column9.Resizable = System.Windows.Forms.DataGridViewTriState.True;
            this.Column9.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column9.SourceFields = "Ten_Vt, Dvt";
            this.Column9.TableName = "DMVT";
            this.Column9.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.Column9.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.Column9.Width = 90;
            // 
            // Column10
            // 
            this.Column10.DataPropertyName = "Ten_Vt";
            this.Column10.HeaderText = "Tên vật tư";
            this.Column10.MinimumWidth = 120;
            this.Column10.Name = "Column10";
            this.Column10.ReadOnly = true;
            this.Column10.Width = 120;
            // 
            // Column11
            // 
            this.Column11.DataPropertyName = "Dvt";
            dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.Column11.DefaultCellStyle = dataGridViewCellStyle2;
            this.Column11.DisabledForeColor = System.Drawing.Color.Blue;
            this.Column11.HeaderText = "Đvt";
            this.Column11.MinimumWidth = 40;
            this.Column11.Name = "Column11";
            this.Column11.Resizable = System.Windows.Forms.DataGridViewTriState.True;
            this.Column11.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column11.UserTextLength = QMVnSoft.AppInstance.TextControlLength.None;
            this.Column11.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.Column11.Width = 40;
            // 
            // Column12
            // 
            this.Column12.DataPropertyName = "Ma_Kho";
            dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.Column12.DefaultCellStyle = dataGridViewCellStyle3;
            this.Column12.DestinationFields = "Ten_Kho";
            this.Column12.DisabledForeColor = System.Drawing.Color.Blue;
            this.Column12.EmptyIsValid = true;
            this.Column12.HeaderText = "Kho";
            this.Column12.MinimumWidth = 50;
            this.Column12.Name = "Column12";
            this.Column12.Resizable = System.Windows.Forms.DataGridViewTriState.True;
            this.Column12.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column12.SourceFields = "Ten_Kho";
            this.Column12.TableName = "DMKHO";
            this.Column12.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.Column12.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.Column12.Width = 50;
            // 
            // Column13
            // 
            this.Column13.DataPropertyName = "Ma_Bp";
            dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.Column13.DefaultCellStyle = dataGridViewCellStyle4;
            this.Column13.DestinationFields = "Ten_Bp";
            this.Column13.DisabledForeColor = System.Drawing.Color.Blue;
            this.Column13.EmptyIsValid = true;
            this.Column13.HeaderText = "Bộ phận";
            this.Column13.Name = "Column13";
            this.Column13.Resizable = System.Windows.Forms.DataGridViewTriState.True;
            this.Column13.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column13.SourceFields = "Ten_Bp";
            this.Column13.TableName = "DMBP";
            this.Column13.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.Column13.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.Column13.Width = 70;
            // 
            // Column14
            // 
            this.Column14.DataPropertyName = "Ma_Hd";
            dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.Column14.DefaultCellStyle = dataGridViewCellStyle5;
            this.Column14.DestinationFields = "Ten_Hd";
            this.Column14.DisabledForeColor = System.Drawing.Color.Blue;
            this.Column14.EmptyIsValid = true;
            this.Column14.HeaderText = "Hợp đồng";
            this.Column14.Name = "Column14";
            this.Column14.Resizable = System.Windows.Forms.DataGridViewTriState.True;
            this.Column14.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column14.SourceFields = "Ten_Hd";
            this.Column14.TableName = "DMHD";
            this.Column14.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.Column14.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.Column14.Width = 70;
            // 
            // Column15
            // 
            this.Column15.DataPropertyName = "Ma_Km";
            dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.Column15.DefaultCellStyle = dataGridViewCellStyle6;
            this.Column15.DestinationFields = "Ten_Km";
            this.Column15.DisabledForeColor = System.Drawing.Color.Blue;
            this.Column15.EmptyIsValid = true;
            this.Column15.HeaderText = "Khoản mục";
            this.Column15.Name = "Column15";
            this.Column15.Resizable = System.Windows.Forms.DataGridViewTriState.True;
            this.Column15.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column15.SourceFields = "Ten_Km";
            this.Column15.TableName = "DMKM";
            this.Column15.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.Column15.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.Column15.Width = 70;
            // 
            // Column17
            // 
            this.Column17.DataPropertyName = "Lo_Hang";
            dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.Column17.DefaultCellStyle = dataGridViewCellStyle7;
            this.Column17.DestinationFields = "Han_Dung, H_Luong, Do_Am_PT, Do_Con_PT";
            this.Column17.DisabledForeColor = System.Drawing.Color.Blue;
            this.Column17.EmptyIsValid = true;
            this.Column17.HeaderText = "Lô hàng";
            this.Column17.Name = "Column17";
            this.Column17.Resizable = System.Windows.Forms.DataGridViewTriState.True;
            this.Column17.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column17.SourceFields = "Han_Dung, H_Luong, Do_Am_PT, Do_Con_PT";
            this.Column17.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.Column17.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.Column17.Width = 70;
            // 
            // Column18
            // 
            this.Column18.DataPropertyName = "Han_Dung";
            dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.Column18.DefaultCellStyle = dataGridViewCellStyle8;
            this.Column18.HeaderText = "Hạn dùng";
            this.Column18.Name = "Column18";
            this.Column18.Resizable = System.Windows.Forms.DataGridViewTriState.False;
            this.Column18.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column18.Width = 70;
            // 
            // Column19
            // 
            this.Column19.DataPropertyName = "H_Luong";
            dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            this.Column19.DefaultCellStyle = dataGridViewCellStyle9;
            this.Column19.HeaderText = "Hàm lượng";
            this.Column19.MinimumWidth = 60;
            this.Column19.Name = "Column19";
            this.Column19.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column19.UserTextNumericFormat = QMVnSoft.AppInstance.TextNumericFormat.Percent;
            this.Column19.Width = 60;
            // 
            // Column20
            // 
            this.Column20.DataPropertyName = "Do_Am_PT";
            dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            this.Column20.DefaultCellStyle = dataGridViewCellStyle10;
            this.Column20.HeaderText = "Độ ẩm";
            this.Column20.MinimumWidth = 60;
            this.Column20.Name = "Column20";
            this.Column20.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column20.UserTextNumericFormat = QMVnSoft.AppInstance.TextNumericFormat.Percent;
            this.Column20.Width = 60;
            // 
            // Column21
            // 
            this.Column21.DataPropertyName = "Do_Con_PT";
            dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            this.Column21.DefaultCellStyle = dataGridViewCellStyle11;
            this.Column21.HeaderText = "Độ cồn";
            this.Column21.MinimumWidth = 60;
            this.Column21.Name = "Column21";
            this.Column21.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column21.UserTextNumericFormat = QMVnSoft.AppInstance.TextNumericFormat.Percent;
            this.Column21.Width = 60;
            // 
            // Column22
            // 
            this.Column22.DataPropertyName = "So_Luong9";
            dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            this.Column22.DefaultCellStyle = dataGridViewCellStyle12;
            this.Column22.HeaderText = "Số lượng";
            this.Column22.MinimumWidth = 80;
            this.Column22.Name = "Column22";
            this.Column22.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column22.UserTextNumericFormat = QMVnSoft.AppInstance.TextNumericFormat.Quantity;
            this.Column22.Width = 80;
            this.Column22.ZeroIsValid = true;
            // 
            // Column23
            // 
            this.Column23.DataPropertyName = "Gia_Nt9";
            dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            this.Column23.DefaultCellStyle = dataGridViewCellStyle13;
            this.Column23.HeaderText = "Đơn giá";
            this.Column23.MinimumWidth = 80;
            this.Column23.Name = "Column23";
            this.Column23.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column23.UserTextNumericFormat = QMVnSoft.AppInstance.TextNumericFormat.ForeignPrice;
            this.Column23.Width = 80;
            this.Column23.ZeroIsValid = true;
            // 
            // Column24
            // 
            this.Column24.DataPropertyName = "Tien_Nt9";
            dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            this.Column24.DefaultCellStyle = dataGridViewCellStyle14;
            this.Column24.HeaderText = "Thành tiền";
            this.Column24.MinimumWidth = 90;
            this.Column24.Name = "Column24";
            this.Column24.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column24.UserTextNumericFormat = QMVnSoft.AppInstance.TextNumericFormat.ForeignAmount;
            this.Column24.Width = 90;
            this.Column24.ZeroIsValid = true;
            // 
            // Column16
            // 
            this.Column16.DataPropertyName = "Thue_XK";
            dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            this.Column16.DefaultCellStyle = dataGridViewCellStyle15;
            this.Column16.HeaderText = "%XK";
            this.Column16.MinimumWidth = 70;
            this.Column16.Name = "Column16";
            this.Column16.Resizable = System.Windows.Forms.DataGridViewTriState.True;
            this.Column16.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column16.UserTextNumericFormat = QMVnSoft.AppInstance.TextNumericFormat.Percent;
            this.Column16.Width = 70;
            this.Column16.ZeroIsValid = true;
            // 
            // Column25
            // 
            this.Column25.DataPropertyName = "Tien_Nt5";
            dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            this.Column25.DefaultCellStyle = dataGridViewCellStyle16;
            this.Column25.HeaderText = "Thuế XK";
            this.Column25.MinimumWidth = 90;
            this.Column25.Name = "Column25";
            this.Column25.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column25.UserTextNumericFormat = QMVnSoft.AppInstance.TextNumericFormat.ForeignAmount;
            this.Column25.Width = 90;
            this.Column25.ZeroIsValid = true;
            // 
            // Column26
            // 
            this.Column26.DataPropertyName = "Thue_TTDB";
            dataGridViewCellStyle17.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            this.Column26.DefaultCellStyle = dataGridViewCellStyle17;
            this.Column26.HeaderText = "%ĐB";
            this.Column26.MinimumWidth = 70;
            this.Column26.Name = "Column26";
            this.Column26.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column26.UserTextNumericFormat = QMVnSoft.AppInstance.TextNumericFormat.Percent;
            this.Column26.Width = 70;
            this.Column26.ZeroIsValid = true;
            // 
            // Column27
            // 
            this.Column27.DataPropertyName = "Tien_Nt8";
            dataGridViewCellStyle18.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            this.Column27.DefaultCellStyle = dataGridViewCellStyle18;
            this.Column27.HeaderText = "Thuế TTĐB";
            this.Column27.MinimumWidth = 90;
            this.Column27.Name = "Column27";
            this.Column27.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column27.UserTextNumericFormat = QMVnSoft.AppInstance.TextNumericFormat.ForeignAmount;
            this.Column27.Width = 90;
            this.Column27.ZeroIsValid = true;
            // 
            // Column28
            // 
            this.Column28.DataPropertyName = "Chiet_Khau";
            dataGridViewCellStyle19.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            this.Column28.DefaultCellStyle = dataGridViewCellStyle19;
            this.Column28.HeaderText = "%Ck";
            this.Column28.MinimumWidth = 70;
            this.Column28.Name = "Column28";
            this.Column28.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column28.UserTextNumericFormat = QMVnSoft.AppInstance.TextNumericFormat.Percent;
            this.Column28.Width = 70;
            this.Column28.ZeroIsValid = true;
            // 
            // Column29
            // 
            this.Column29.DataPropertyName = "Tien_Nt4";
            dataGridViewCellStyle20.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            this.Column29.DefaultCellStyle = dataGridViewCellStyle20;
            this.Column29.HeaderText = "Chiết khấu";
            this.Column29.MinimumWidth = 90;
            this.Column29.Name = "Column29";
            this.Column29.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column29.UserTextNumericFormat = QMVnSoft.AppInstance.TextNumericFormat.ForeignAmount;
            this.Column29.Width = 90;
            this.Column29.ZeroIsValid = true;
            // 
            // Column30
            // 
            this.Column30.DataPropertyName = "Tien_Nt6";
            dataGridViewCellStyle21.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            this.Column30.DefaultCellStyle = dataGridViewCellStyle21;
            this.Column30.HeaderText = "Chi phí";
            this.Column30.MinimumWidth = 90;
            this.Column30.Name = "Column30";
            this.Column30.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column30.UserTextNumericFormat = QMVnSoft.AppInstance.TextNumericFormat.ForeignAmount;
            this.Column30.Width = 90;
            this.Column30.ZeroIsValid = true;
            // 
            // Column31
            // 
            this.Column31.DataPropertyName = "Thue_GTGT";
            dataGridViewCellStyle22.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            this.Column31.DefaultCellStyle = dataGridViewCellStyle22;
            this.Column31.HeaderText = "%GT";
            this.Column31.MinimumWidth = 70;
            this.Column31.Name = "Column31";
            this.Column31.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column31.UserTextNumericFormat = QMVnSoft.AppInstance.TextNumericFormat.Percent;
            this.Column31.Width = 70;
            this.Column31.ZeroIsValid = true;
            // 
            // Column32
            // 
            this.Column32.DataPropertyName = "Tien_Nt3";
            dataGridViewCellStyle23.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            this.Column32.DefaultCellStyle = dataGridViewCellStyle23;
            this.Column32.HeaderText = "Thuế GTGT";
            this.Column32.MinimumWidth = 90;
            this.Column32.Name = "Column32";
            this.Column32.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.Column32.UserTextNumericFormat = QMVnSoft.AppInstance.TextNumericFormat.ForeignAmount;
            this.Column32.Width = 90;
            this.Column32.ZeroIsValid = true;
            // 
            // FormCTBHEditor
            // 
            this.ClientSize = new System.Drawing.Size(794, 539);
            this.Controls.Add(this.txtLoai_Ck);
            this.Controls.Add(this.lblLoai_Ck);
            this.Controls.Add(this.txtGia_Thue);
            this.Controls.Add(this.lblGia_Thue);
            this.Controls.Add(this.lblSo_Seri);
            this.Controls.Add(this.lblSo_Seri0);
            this.Controls.Add(this.lblSo_Ct0);
            this.Controls.Add(this.txtSo_Seri);
            this.Controls.Add(this.txtSo_Seri0);
            this.Controls.Add(this.txtSo_Ct0);
            this.Controls.Add(this.txtThue_GTGT);
            this.Controls.Add(this.lblThue_GTGT);
            this.Controls.Add(this.txtTien_Cash);
            this.Controls.Add(this.lblTien_Cash);
            this.Controls.Add(this.txtTTien_Nt3);
            this.Controls.Add(this.lblTTien_Nt3);
            this.Controls.Add(this.txtTTien_Nt4);
            this.Controls.Add(this.txtTTien_Nt5);
            this.Controls.Add(this.lblTTien_Nt4);
            this.Controls.Add(this.lblTTien_Nt5);
            this.Controls.Add(this.txtTTien_Nt8);
            this.Controls.Add(this.txtTTien_Nt2);
            this.Controls.Add(this.lblTTien_Nt8);
            this.Controls.Add(this.lblTTien_Nt2);
            this.Controls.Add(this.txtTTien_Nt6);
            this.Controls.Add(this.lblTTien_Nt6);
            this.Controls.Add(this.txtTTien_Nt0);
            this.Controls.Add(this.lblTTien_Nt0);
            this.Controls.Add(this.txtNgay_Ct0);
            this.Controls.Add(this.lblNgay_Ct0);
            this.Controls.Add(this.txtHan_Tt);
            this.Controls.Add(this.lblHan_Tt);
            this.Controls.Add(this.txtMa_Tte);
            this.Controls.Add(this.txtTy_Gia);
            this.Controls.Add(this.txtDia_Chi);
            this.Controls.Add(this.txtOng_Ba);
            this.Controls.Add(this.txtTen_Dt);
            this.Controls.Add(this.lblMa_Tte);
            this.Controls.Add(this.txtMa_Dt);
            this.Controls.Add(this.lblDia_Chi);
            this.Controls.Add(this.lblOng_Ba);
            this.Controls.Add(this.lblMa_Dt);
            this.Controls.Add(this.txtDesc_EN);
            this.Controls.Add(this.txtDien_Giai);
            this.Controls.Add(this.txtTen_Nx);
            this.Controls.Add(this.txtTen_Hd);
            this.Controls.Add(this.txtTen_Km);
            this.Controls.Add(this.txtTen_Bp);
            this.Controls.Add(this.lblDesc_EN);
            this.Controls.Add(this.lblDien_Giai);
            this.Controls.Add(this.txtMa_Nx);
            this.Controls.Add(this.txtMa_Hd);
            this.Controls.Add(this.lblMa_Nx);
            this.Controls.Add(this.lblMa_Hd);
            this.Controls.Add(this.txtMa_Km);
            this.Controls.Add(this.lblMa_Km);
            this.Controls.Add(this.txtMa_Bp);
            this.Controls.Add(this.lblMa_Bp);
            this.Controls.Add(this.grdDetail);
            this.Controls.Add(this.grdSubDetail);
            this.Name = "FormCTBHEditor";
            this.Controls.SetChildIndex(this.grdSubDetail, 0);
            this.Controls.SetChildIndex(this.grdDetail, 0);
            this.Controls.SetChildIndex(this.lblPhan_Loai, 0);
            this.Controls.SetChildIndex(this.txtSo_Ct, 0);
            this.Controls.SetChildIndex(this.txtNgay_Ps, 0);
            this.Controls.SetChildIndex(this.txtNgay_Ct, 0);
            this.Controls.SetChildIndex(this.txtMa_Loai1, 0);
            this.Controls.SetChildIndex(this.txtMa_Loai2, 0);
            this.Controls.SetChildIndex(this.txtMa_Loai3, 0);
            this.Controls.SetChildIndex(this.lblMa_Bp, 0);
            this.Controls.SetChildIndex(this.txtMa_Bp, 0);
            this.Controls.SetChildIndex(this.lblMa_Km, 0);
            this.Controls.SetChildIndex(this.txtMa_Km, 0);
            this.Controls.SetChildIndex(this.lblMa_Hd, 0);
            this.Controls.SetChildIndex(this.lblMa_Nx, 0);
            this.Controls.SetChildIndex(this.txtMa_Hd, 0);
            this.Controls.SetChildIndex(this.txtMa_Nx, 0);
            this.Controls.SetChildIndex(this.lblDien_Giai, 0);
            this.Controls.SetChildIndex(this.lblDesc_EN, 0);
            this.Controls.SetChildIndex(this.txtTen_Bp, 0);
            this.Controls.SetChildIndex(this.txtTen_Km, 0);
            this.Controls.SetChildIndex(this.txtTen_Hd, 0);
            this.Controls.SetChildIndex(this.txtTen_Nx, 0);
            this.Controls.SetChildIndex(this.txtDien_Giai, 0);
            this.Controls.SetChildIndex(this.txtDesc_EN, 0);
            this.Controls.SetChildIndex(this.lblMa_Dt, 0);
            this.Controls.SetChildIndex(this.lblOng_Ba, 0);
            this.Controls.SetChildIndex(this.lblDia_Chi, 0);
            this.Controls.SetChildIndex(this.txtMa_Dt, 0);
            this.Controls.SetChildIndex(this.lblMa_Tte, 0);
            this.Controls.SetChildIndex(this.txtTen_Dt, 0);
            this.Controls.SetChildIndex(this.txtOng_Ba, 0);
            this.Controls.SetChildIndex(this.txtDia_Chi, 0);
            this.Controls.SetChildIndex(this.txtTy_Gia, 0);
            this.Controls.SetChildIndex(this.txtMa_Tte, 0);
            this.Controls.SetChildIndex(this.lblHan_Tt, 0);
            this.Controls.SetChildIndex(this.txtHan_Tt, 0);
            this.Controls.SetChildIndex(this.lblNgay_Ct0, 0);
            this.Controls.SetChildIndex(this.txtNgay_Ct0, 0);
            this.Controls.SetChildIndex(this.lblTTien_Nt0, 0);
            this.Controls.SetChildIndex(this.txtTTien_Nt0, 0);
            this.Controls.SetChildIndex(this.lblTTien_Nt6, 0);
            this.Controls.SetChildIndex(this.txtTTien_Nt6, 0);
            this.Controls.SetChildIndex(this.lblTTien_Nt2, 0);
            this.Controls.SetChildIndex(this.lblTTien_Nt8, 0);
            this.Controls.SetChildIndex(this.txtTTien_Nt2, 0);
            this.Controls.SetChildIndex(this.txtTTien_Nt8, 0);
            this.Controls.SetChildIndex(this.lblTTien_Nt5, 0);
            this.Controls.SetChildIndex(this.lblTTien_Nt4, 0);
            this.Controls.SetChildIndex(this.txtTTien_Nt5, 0);
            this.Controls.SetChildIndex(this.txtTTien_Nt4, 0);
            this.Controls.SetChildIndex(this.lblTTien_Nt3, 0);
            this.Controls.SetChildIndex(this.txtTTien_Nt3, 0);
            this.Controls.SetChildIndex(this.lblTien_Cash, 0);
            this.Controls.SetChildIndex(this.txtTien_Cash, 0);
            this.Controls.SetChildIndex(this.lblThue_GTGT, 0);
            this.Controls.SetChildIndex(this.txtThue_GTGT, 0);
            this.Controls.SetChildIndex(this.txtSo_Ct0, 0);
            this.Controls.SetChildIndex(this.txtSo_Seri0, 0);
            this.Controls.SetChildIndex(this.txtSo_Seri, 0);
            this.Controls.SetChildIndex(this.lblSo_Ct0, 0);
            this.Controls.SetChildIndex(this.lblSo_Seri0, 0);
            this.Controls.SetChildIndex(this.lblSo_Seri, 0);
            this.Controls.SetChildIndex(this.lblGia_Thue, 0);
            this.Controls.SetChildIndex(this.txtGia_Thue, 0);
            this.Controls.SetChildIndex(this.lblLoai_Ck, 0);
            this.Controls.SetChildIndex(this.txtLoai_Ck, 0);
            ((System.ComponentModel.ISupportInitialize)(this.grdDetail)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.grdSubDetail)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        private void MakeDetailInput(object sender, EventArgs e)
        {
            if (base.txtNgay_Ct.Value.Equals(DBNull.Value))
            {
                MessageBox.Show("Chưa nhập ngày chứng từ!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            else if (this.txtMa_Dt.Value.Equals(DBNull.Value))
            {
                MessageBox.Show("Chưa nhập mã đối tượng!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            else if (this.txtMa_Nx.Value.Equals(DBNull.Value))
            {
                MessageBox.Show("Chưa nhập mã nhập xuất!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            else
            {
                DataRow row;
                DataTable table = new DataTable();
                DataColumn column = new DataColumn("Stt0_D", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("Ma_Bp", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("Ma_Hd", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("Ma_Km", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("Ma_Kho", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("Ma_Vt", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("Ten_Vt", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("Dvt", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("He_So9", typeof(decimal));
                table.Columns.Add(column);
                column = new DataColumn("So_Luong0", typeof(decimal));
                table.Columns.Add(column);
                column = new DataColumn("So_Luong", typeof(decimal));
                table.Columns.Add(column);
                column = new DataColumn("Gia_Tb_Tt", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("Tien", typeof(decimal));
                table.Columns.Add(column);
                column = new DataColumn("Gia2", typeof(decimal));
                table.Columns.Add(column);
                column = new DataColumn("Tien2", typeof(decimal));
                table.Columns.Add(column);
                column = new DataColumn("Thue_GTGT", typeof(decimal));
                table.Columns.Add(column);
                column = new DataColumn("Tien3", typeof(decimal));
                table.Columns.Add(column);
                column = new DataColumn("Thue_XK", typeof(decimal));
                table.Columns.Add(column);
                column = new DataColumn("Tien5", typeof(decimal));
                table.Columns.Add(column);
                column = new DataColumn("Thue_TTDB", typeof(decimal));
                table.Columns.Add(column);
                column = new DataColumn("Tien8", typeof(decimal));
                table.Columns.Add(column);
                column = new DataColumn("Chiet_Khau", typeof(decimal));
                table.Columns.Add(column);
                column = new DataColumn("Tien4", typeof(decimal));
                table.Columns.Add(column);
                column = new DataColumn("Tien7", typeof(decimal));
                table.Columns.Add(column);
                column = new DataColumn("Tien6", typeof(decimal));
                table.Columns.Add(column);
                column = new DataColumn("Tk_No", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("Tk_Co", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("Tk_No2", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("Tk_Co2", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("Tk_No3", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("Tk_Co3", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("Tk_No5", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("Tk_Co5", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("Tk_No8", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("Tk_Co8", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("Tk_No4", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("Tk_Co4", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("Tk_No6", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("Tk_Co6", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("Lo_Hang", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("Han_Dung", typeof(DateTime));
                table.Columns.Add(column);
                column = new DataColumn("H_Luong", typeof(decimal));
                table.Columns.Add(column);
                column = new DataColumn("Do_Am_PT", typeof(decimal));
                table.Columns.Add(column);
                column = new DataColumn("Do_Con_PT", typeof(decimal));
                table.Columns.Add(column);
                table.PrimaryKey = new DataColumn[] { table.Columns["Stt0_D"] };
                foreach (DataRow row2 in base.LocalDetailTable.Rows)
                {
                    if (((row2.RowState != DataRowState.Deleted) && (row2.RowState != DataRowState.Deleted)) && (!string.IsNullOrEmpty(row2["Ma_Vt"].ToString()) && !string.IsNullOrEmpty(row2["Stt0_D"].ToString())))
                    {
                        row = table.NewRow();
                        row["Stt0_D"] = row2["Stt0_D"];
                        row["Ma_Bp"] = row2["Ma_Bp"];
                        row["Ma_Hd"] = row2["Ma_Hd"];
                        row["Ma_Km"] = row2["Ma_Km"];
                        row["Ma_Kho"] = row2["Ma_Kho"];
                        row["Ma_Vt"] = row2["Ma_Vt"];
                        row["Ten_Vt"] = row2["Ten_Vt"];
                        row["Dvt"] = row2["Dvt"];
                        row["He_So9"] = row2["He_So9"];
                        row["So_Luong0"] = row2["So_Luong"];
                        row["So_Luong"] = row2["So_Luong"];
                        row["Gia_Tb_Tt"] = row2["Gia_Tb_Tt"];
                        row["Tien"] = row2["Tien"];
                        row["Gia2"] = row2["Gia2"];
                        row["Tien2"] = row2["Tien2"];
                        row["Thue_GTGT"] = row2["Thue_GTGT"];
                        row["Tien3"] = row2["Tien3"];
                        row["Thue_XK"] = row2["Thue_XK"];
                        row["Tien5"] = row2["Tien5"];
                        row["Thue_TTDB"] = row2["Thue_TTDB"];
                        row["Tien8"] = row2["Tien8"];
                        row["Chiet_Khau"] = row2["Chiet_Khau"];
                        row["Tien4"] = row2["Tien4"];
                        row["Tien7"] = row2["Tien7"];
                        row["Tien6"] = row2["Tien6"];
                        row["Tk_No"] = row2["Tk_No"];
                        row["Tk_Co"] = row2["Tk_Co"];
                        row["Tk_No2"] = row2["Tk_No2"];
                        row["Tk_Co2"] = row2["Tk_Co2"];
                        row["Tk_No3"] = row2["Tk_No3"];
                        row["Tk_Co3"] = row2["Tk_Co3"];
                        row["Tk_No5"] = row2["Tk_No5"];
                        row["Tk_Co5"] = row2["Tk_Co5"];
                        row["Tk_No8"] = row2["Tk_No8"];
                        row["Tk_Co8"] = row2["Tk_Co8"];
                        row["Tk_No4"] = row2["Tk_No4"];
                        row["Tk_Co4"] = row2["Tk_Co4"];
                        row["Tk_No6"] = row2["Tk_No6"];
                        row["Tk_Co6"] = row2["Tk_Co6"];
                        row["Lo_Hang"] = row2["Lo_Hang"];
                        row["Han_Dung"] = row2["Han_Dung"];
                        row["H_Luong"] = row2["H_Luong"];
                        row["Do_Am_PT"] = row2["Do_Am_PT"];
                        row["Do_Con_PT"] = row2["Do_Con_PT"];
                        table.Rows.Add(row);
                    }
                }
                FormCTBHF4Editor editor = new FormCTBHF4Editor(base.SavedMasterOrder, base.txtNgay_Ct.Value, this.txtMa_Dt.Value, table);
                editor.ShowDialog();
                if (editor.CheckAccepted)
                {
                    int num = 0;
                    object obj2 = "";
                    object obj3 = "";
                    object obj4 = 0;
                    object obj5 = 0;
                    object obj6 = 0;
                    object obj7 = 0;
                    object obj8 = 0;
                    object obj9 = 0;
                    object obj10 = 0;
                    object obj11 = 0;
                    object obj12 = 0;
                    object obj13 = 0;
                    object obj14 = 0;
                    object obj15 = 0;
                    object obj16 = 0;
                    object obj17 = 0;
                    object obj18 = 0;
                    object obj19 = 0;
                    object obj20 = 0;
                    object obj21 = 0;
                    object obj22 = 0;
                    object obj23 = 0;
                    object obj24 = 0;
                    object obj25 = 0;
                    object obj26 = 0;
                    object obj27 = 0;
                    decimal num2 = 0M;
                    base.LocalDetailTable.AcceptChanges();
                    foreach (DataRow row3 in base.LocalDetailTable.Rows)
                    {
                        if (row3.RowState != DataRowState.Deleted)
                        {
                            row3.Delete();
                        }
                    }
                    foreach (DataRow row4 in table.Rows)
                    {
                        if (((row4.RowState != DataRowState.Deleted) && !row4["So_Luong"].Equals(DBNull.Value)) && (((decimal) row4["So_Luong"]) != 0M))
                        {
                            num++;
                            row = base.MakeDetailRow();
                            obj2 = string.IsNullOrEmpty(row4["Ma_Bp"].ToString()) ? this.txtMa_Bp.Value : row4["Ma_Bp"];
                            obj3 = string.IsNullOrEmpty(row4["Ma_Hd"].ToString()) ? this.txtMa_Hd.Value : row4["Ma_Hd"];
                            obj5 = row4["So_Luong"];
                            obj8 = row4["So_Luong0"].Equals(row4["So_Luong"]) ? row4["Tien"] : decimal.Round((((decimal) row4["Tien"]) * ((decimal) row4["So_Luong0"])) / ((decimal) obj5), base.LCAmountDecimals);
                            obj9 = decimal.Round(((decimal) obj8) / base.ExchangeRate, base.FCAmountDecimals);
                            obj6 = decimal.Round(((decimal) obj8) / ((decimal) obj5), base.LCPriceDecimals);
                            obj7 = decimal.Round(((decimal) obj6) / base.ExchangeRate, base.FCPriceDecimals);
                            obj10 = row4["Gia2"];
                            obj11 = decimal.Round(((decimal) obj10) / base.ExchangeRate, base.FCPriceDecimals);
                            obj12 = row4["So_Luong0"].Equals(row4["So_Luong"]) ? row4["Tien2"] : decimal.Round((((decimal) row4["Tien2"]) * ((decimal) row4["So_Luong0"])) / ((decimal) obj5), base.LCAmountDecimals);
                            obj13 = decimal.Round(((decimal) obj12) / base.ExchangeRate, base.FCAmountDecimals);
                            obj4 = decimal.Round(((decimal) obj5) / ((decimal) row4["He_So9"]), base.QuantityDecimals);
                            obj14 = decimal.Round(((decimal) obj10) * ((decimal) row4["He_So9"]), base.LCPriceDecimals);
                            obj15 = decimal.Round(((decimal) obj14) / base.ExchangeRate, base.FCPriceDecimals);
                            obj16 = row4["So_Luong0"].Equals(row4["So_Luong"]) ? row4["Tien3"] : decimal.Round((((decimal) row4["Tien3"]) * ((decimal) row4["So_Luong0"])) / ((decimal) obj5), base.LCAmountDecimals);
                            obj17 = decimal.Round(((decimal) obj16) / base.ExchangeRate, base.FCAmountDecimals);
                            obj18 = row4["So_Luong0"].Equals(row4["So_Luong"]) ? row4["Tien5"] : decimal.Round((((decimal) row4["Tien5"]) * ((decimal) row4["So_Luong0"])) / ((decimal) obj5), base.LCAmountDecimals);
                            obj19 = decimal.Round(((decimal) obj18) / base.ExchangeRate, base.FCAmountDecimals);
                            obj20 = row4["So_Luong0"].Equals(row4["So_Luong"]) ? row4["Tien8"] : decimal.Round((((decimal) row4["Tien8"]) * ((decimal) row4["So_Luong0"])) / ((decimal) obj5), base.LCAmountDecimals);
                            obj21 = decimal.Round(((decimal) obj20) / base.ExchangeRate, base.FCAmountDecimals);
                            obj22 = row4["So_Luong0"].Equals(row4["So_Luong"]) ? row4["Tien4"] : decimal.Round((((decimal) row4["Tien4"]) * ((decimal) row4["So_Luong0"])) / ((decimal) obj5), base.LCAmountDecimals);
                            obj23 = decimal.Round(((decimal) obj22) / base.ExchangeRate, base.FCAmountDecimals);
                            obj24 = row4["So_Luong0"].Equals(row4["So_Luong"]) ? row4["Tien6"] : decimal.Round((((decimal) row4["Tien6"]) * ((decimal) row4["So_Luong0"])) / ((decimal) obj5), base.LCAmountDecimals);
                            obj25 = decimal.Round(((decimal) obj24) / base.ExchangeRate, base.FCAmountDecimals);
                            obj26 = row4["So_Luong0"].Equals(row4["So_Luong"]) ? row4["Tien7"] : decimal.Round((((decimal) row4["Tien7"]) * ((decimal) row4["So_Luong0"])) / ((decimal) obj5), base.LCAmountDecimals);
                            obj27 = decimal.Round(((decimal) obj26) / base.ExchangeRate, base.FCAmountDecimals);
                            if (((decimal) row4["Thue_GTGT"]) > num2)
                            {
                                num2 = (decimal) row4["Thue_GTGT"];
                            }
                            row["Stt0_D"] = row4["Stt0_D"];
                            row["Stt_Nv"] = num;
                            row["Ma_Vt"] = row4["Ma_Vt"];
                            row["Ten_Vt"] = row4["Ten_Vt"];
                            row["Dvt"] = row4["Dvt"];
                            row["He_So9"] = row4["He_So9"];
                            row["Ma_Bp"] = obj2;
                            row["Ma_Hd"] = obj3;
                            row["Ma_Km"] = row4["Ma_Km"];
                            row["Ma_Kho"] = row4["Ma_Kho"];
                            row["So_Luong9"] = obj4;
                            row["Gia_Nt9"] = obj15;
                            row["Gia9"] = obj14;
                            row["Tien_Nt9"] = obj13;
                            row["Tien9"] = obj12;
                            row["So_Luong"] = obj5;
                            row["Gia_Tb_Tt"] = row4["Gia_Tb_Tt"];
                            row["Gia_Nt"] = obj7;
                            row["Gia"] = obj6;
                            row["Tien_Nt"] = obj9;
                            row["Tien"] = obj8;
                            row["Gia_Nt2"] = obj11;
                            row["Gia2"] = obj10;
                            row["Tien_Nt2"] = obj13;
                            row["Tien2"] = obj12;
                            row["Thue_GTGT"] = row4["Thue_GTGT"];
                            row["Tien_Nt3"] = obj17;
                            row["Tien3"] = obj16;
                            row["Thue_XK"] = row4["Thue_XK"];
                            row["Tien_Nt5"] = obj19;
                            row["Tien5"] = obj18;
                            row["Thue_TTDB"] = row4["Thue_TTDB"];
                            row["Tien_Nt8"] = obj21;
                            row["Tien8"] = obj20;
                            row["Chiet_Khau"] = row4["Chiet_Khau"];
                            row["Tien_Nt4"] = obj23;
                            row["Tien4"] = obj22;
                            row["Tien_Nt6"] = obj25;
                            row["Tien6"] = obj24;
                            row["Tien_Nt7"] = obj27;
                            row["Tien7"] = obj26;
                            row["H_Luong"] = row4["H_Luong"];
                            row["Do_Am_PT"] = row4["Do_Am_PT"];
                            row["Do_Con_PT"] = row4["Do_Con_PT"];
                            this.UpdateVtParameters(row);
                            base.LocalDetailTable.Rows.Add(row);
                        }
                    }
                    this.txtThue_GTGT.Value = num2;
                    base.DetailGridBrowser.CurrentCell = base.DetailGridBrowser.FirstDisplayedCell;
                    base.DetailGridBrowser.Focus();
                    this.Sum();
                }
            }
        }

        private void MakeDetailInvoice(object sender, EventArgs e)
        {
            if (base.txtNgay_Ct.Value.Equals(DBNull.Value))
            {
                MessageBox.Show("Chưa nhập ngày chứng từ!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            else if (this.txtMa_Dt.Value.Equals(DBNull.Value))
            {
                MessageBox.Show("Chưa nhập mã đối tượng!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            else if (this.txtMa_Nx.Value.Equals(DBNull.Value))
            {
                MessageBox.Show("Chưa nhập mã nhập xuất!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            else
            {
                DataRow row;
                DataTable table = new DataTable();
                DataColumn column = new DataColumn("Stt0_D", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("Ma_Bp", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("Ma_Hd", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("Ma_Vt", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("Ten_Vt", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("Dvt", typeof(string));
                table.Columns.Add(column);
                column = new DataColumn("He_So9", typeof(decimal));
                table.Columns.Add(column);
                column = new DataColumn("So_Luong", typeof(decimal));
                table.Columns.Add(column);
                column = new DataColumn("Gia", typeof(decimal));
                table.Columns.Add(column);
                table.PrimaryKey = new DataColumn[] { table.Columns["Stt0_D"] };
                foreach (DataRow row2 in base.LocalDetailTable.Rows)
                {
                    if (((row2.RowState != DataRowState.Deleted) && (row2.RowState != DataRowState.Deleted)) && (!string.IsNullOrEmpty(row2["Ma_Vt"].ToString()) && !string.IsNullOrEmpty(row2["Stt0_D"].ToString())))
                    {
                        row = table.NewRow();
                        row["Stt0_D"] = row2["Stt0_D"];
                        row["Ma_Bp"] = row2["Ma_Bp"];
                        row["Ma_Hd"] = row2["Ma_Hd"];
                        row["Ma_Vt"] = row2["Ma_Vt"];
                        row["Ten_Vt"] = row2["Ten_Vt"];
                        row["Dvt"] = row2["Dvt"];
                        row["He_So9"] = row2["He_So9"];
                        row["So_Luong"] = row2["So_Luong"];
                        row["Gia"] = row2["Gia"];
                        table.Rows.Add(row);
                    }
                }
                FormCTDHBF4Editor editor = new FormCTDHBF4Editor(base.SavedMasterOrder, base.txtNgay_Ct.Value, this.txtMa_Dt.Value, table);
                editor.ShowDialog();
                if (editor.CheckAccepted)
                {
                    int num = 0;
                    object obj2 = "";
                    object obj3 = "";
                    object obj4 = 0;
                    object obj5 = 0;
                    object obj6 = 0;
                    object obj7 = 0;
                    object obj8 = 0;
                    object obj9 = 0;
                    object obj10 = 0;
                    object obj11 = 0;
                    base.LocalDetailTable.AcceptChanges();
                    foreach (DataRow row3 in base.LocalDetailTable.Rows)
                    {
                        if (row3.RowState != DataRowState.Deleted)
                        {
                            row3.Delete();
                        }
                    }
                    foreach (DataRow row4 in table.Rows)
                    {
                        if (((row4.RowState != DataRowState.Deleted) && !row4["So_Luong"].Equals(DBNull.Value)) && !(((decimal) row4["So_Luong"]) == 0M))
                        {
                            num++;
                            row = base.MakeDetailRow();
                            obj2 = string.IsNullOrEmpty(row4["Ma_Bp"].ToString()) ? this.txtMa_Bp.Value : row4["Ma_Bp"];
                            obj3 = string.IsNullOrEmpty(row4["Ma_Hd"].ToString()) ? this.txtMa_Hd.Value : row4["Ma_Hd"];
                            obj5 = row4["So_Luong"];
                            obj6 = row4["Gia"];
                            obj7 = decimal.Round(((decimal) obj6) / base.ExchangeRate, base.FCPriceDecimals);
                            obj8 = decimal.Round(((decimal) obj6) * ((decimal) obj5), base.LCAmountDecimals);
                            obj9 = decimal.Round(((decimal) obj8) / base.ExchangeRate, base.FCAmountDecimals);
                            obj4 = decimal.Round(((decimal) obj5) / ((decimal) row4["He_So9"]), base.QuantityDecimals);
                            obj10 = decimal.Round(((decimal) obj6) * ((decimal) row4["He_So9"]), base.LCPriceDecimals);
                            obj11 = decimal.Round(((decimal) obj10) / base.ExchangeRate, base.FCPriceDecimals);
                            row["Stt0_D"] = row4["Stt0_D"];
                            row["Stt_Nv"] = num;
                            row["Ma_Vt"] = row4["Ma_Vt"];
                            row["Ten_Vt"] = row4["Ten_Vt"];
                            row["Dvt"] = row4["Dvt"];
                            row["He_So9"] = row4["He_So9"];
                            row["Ma_Bp"] = obj2;
                            row["Ma_Hd"] = obj3;
                            row["So_Luong9"] = obj4;
                            row["Gia_Nt9"] = obj11;
                            row["Gia9"] = obj10;
                            row["Tien_Nt9"] = obj9;
                            row["Tien9"] = obj8;
                            row["So_Luong"] = obj5;
                            row["Gia_Nt"] = 0;
                            row["Gia"] = 0;
                            row["Tien_Nt"] = 0;
                            row["Tien"] = 0;
                            row["Gia_Nt2"] = obj7;
                            row["Gia2"] = obj6;
                            row["Tien_Nt2"] = obj9;
                            row["Tien2"] = obj8;
                            row["Thue_GTGT"] = 0;
                            row["Tien_Nt3"] = 0;
                            row["Tien3"] = 0;
                            row["Thue_XK"] = 0;
                            row["Tien_Nt5"] = 0;
                            row["Tien5"] = 0;
                            row["Thue_TTDB"] = 0;
                            row["Tien_Nt8"] = 0;
                            row["Tien8"] = 0;
                            row["Chiet_Khau"] = 0;
                            row["Tien_Nt4"] = 0;
                            row["Tien4"] = 0;
                            row["Tien_Nt6"] = 0;
                            row["Tien6"] = 0;
                            row["Tien_Nt7"] = 0;
                            row["Tien7"] = 0;
                            row["H_Luong"] = 0;
                            row["Do_Am_PT"] = 0;
                            row["Do_Con_PT"] = 0;
                            row["Gia_Tb_Tt"] = "C";
                            this.UpdateVtParameters(row);
                            base.LocalDetailTable.Rows.Add(row);
                        }
                    }
                    base.DetailGridBrowser.CurrentCell = base.DetailGridBrowser.FirstDisplayedCell;
                    base.DetailGridBrowser.Focus();
                    this.Sum();
                }
            }
        }

        internal override void OnAdd()
        {
            object obj2 = base.LocalMasterRow["So_Ct"];
            base.LocalMasterRow = base.MakeMasterRow();
            base.LocalMasterRow["Nh_Ct"] = base.AppInvoiceParameters.InvoiceType;
            base.LocalMasterRow["So_Ct"] = this.oMethod.Cong_So_Ct(AppInstance.Subsidiary, base.InvoiceCode, base.LocalMasterRow["Ngay_Ct"], obj2);
            base.LocalMasterRow["Ma_Tte"] = AppInstance.DefaultCurrency;
            base.LocalMasterRow["Ty_Gia"] = 1;
            base.LocalMasterRow["Ty_Gia_Ht"] = 1;
            base.LocalMasterRow["TTien_Nt0"] = 0;
            base.LocalMasterRow["TTien0"] = 0;
            base.LocalMasterRow["TTien_Nt"] = 0;
            base.LocalMasterRow["TTien"] = 0;
            base.LocalMasterRow["TTien_Nt2"] = 0;
            base.LocalMasterRow["TTien2"] = 0;
            base.LocalMasterRow["Thue_GTGT"] = 0;
            base.LocalMasterRow["Gia_Thue"] = "K";
            base.LocalMasterRow["TTien_Nt3"] = 0;
            base.LocalMasterRow["TTien3"] = 0;
            base.LocalMasterRow["TTien_Nt5"] = 0;
            base.LocalMasterRow["TTien5"] = 0;
            base.LocalMasterRow["TTien_Nt8"] = 0;
            base.LocalMasterRow["TTien8"] = 0;
            base.LocalMasterRow["Loai_Ck"] = (AppInstance.DiscountType == 0) ? "1" : "2";
            base.LocalMasterRow["TTien_Nt4"] = 0;
            base.LocalMasterRow["TTien4"] = 0;
            base.LocalMasterRow["TTien_Nt6"] = 0;
            base.LocalMasterRow["TTien6"] = 0;
            base.LocalMasterRow["TTien_VAT0"] = 0;
            base.LocalMasterRow["TTien_VAT1"] = 0;
            base.LocalMasterRow["Tien_Cash"] = 0;
            base.MakeDetailTable();
            base.LocalDetailTable.Rows[0]["Stt_Nv"] = 1;
            base.LocalDetailTable.Rows[0]["He_So9"] = 1;
            base.LocalDetailTable.Rows[0]["So_Luong9"] = 0;
            base.LocalDetailTable.Rows[0]["Gia_Nt9"] = 0;
            base.LocalDetailTable.Rows[0]["Gia9"] = 0;
            base.LocalDetailTable.Rows[0]["Tien_Nt9"] = 0;
            base.LocalDetailTable.Rows[0]["Tien9"] = 0;
            base.LocalDetailTable.Rows[0]["So_Luong"] = 0;
            base.LocalDetailTable.Rows[0]["Gia_Tb_Tt"] = "C";
            base.LocalDetailTable.Rows[0]["Gia_Nt"] = 0;
            base.LocalDetailTable.Rows[0]["Gia"] = 0;
            base.LocalDetailTable.Rows[0]["Tien_Nt"] = 0;
            base.LocalDetailTable.Rows[0]["Tien"] = 0;
            base.LocalDetailTable.Rows[0]["Gia_Nt2"] = 0;
            base.LocalDetailTable.Rows[0]["Gia2"] = 0;
            base.LocalDetailTable.Rows[0]["Tien_Nt2"] = 0;
            base.LocalDetailTable.Rows[0]["Tien2"] = 0;
            base.LocalDetailTable.Rows[0]["Thue_GTGT"] = 0;
            base.LocalDetailTable.Rows[0]["Tien_Nt3"] = 0;
            base.LocalDetailTable.Rows[0]["Tien3"] = 0;
            base.LocalDetailTable.Rows[0]["Thue_XK"] = 0;
            base.LocalDetailTable.Rows[0]["Tien_Nt5"] = 0;
            base.LocalDetailTable.Rows[0]["Tien5"] = 0;
            base.LocalDetailTable.Rows[0]["Thue_TTDB"] = 0;
            base.LocalDetailTable.Rows[0]["Tien_Nt8"] = 0;
            base.LocalDetailTable.Rows[0]["Tien8"] = 0;
            base.LocalDetailTable.Rows[0]["Chiet_Khau"] = 0;
            base.LocalDetailTable.Rows[0]["Tien_Nt4"] = 0;
            base.LocalDetailTable.Rows[0]["Tien4"] = 0;
            base.LocalDetailTable.Rows[0]["Tien_Nt6"] = 0;
            base.LocalDetailTable.Rows[0]["Tien6"] = 0;
            base.LocalDetailTable.Rows[0]["H_Luong"] = 0;
            base.LocalDetailTable.Rows[0]["Do_Am_PT"] = 0;
            base.LocalDetailTable.Rows[0]["Do_Con_PT"] = 0;
            if (base.AppInvoiceParameters.AllowDepartmentControl != 1)
            {
                base.LocalMasterRow["Ma_Bp"] = DBNull.Value;
                base.LocalMasterRow["Ten_Bp"] = DBNull.Value;
            }
            if (base.AppInvoiceParameters.AllowContractControl != 1)
            {
                base.LocalMasterRow["Ma_Hd"] = DBNull.Value;
                base.LocalMasterRow["Ten_Hd"] = DBNull.Value;
            }
            if (base.AppInvoiceParameters.AllowCategoryControl != 1)
            {
                base.LocalMasterRow["Ma_Km"] = DBNull.Value;
                base.LocalMasterRow["Ten_Km"] = DBNull.Value;
            }
            base.OnAdd();
        }

        internal override void OnCopy()
        {
            object obj2 = base.LocalMasterRow["So_Ct"];
            base.LocalMasterRow["So_Ct"] = this.oMethod.Cong_So_Ct(AppInstance.Subsidiary, base.InvoiceCode, base.LocalMasterRow["Ngay_Ct"], obj2);
            base.OnCopy();
        }

        internal override void OnResetControls()
        {
            base.DetailGridBrowser = this.grdDetail;
            base.DetailSubBrowser = this.grdSubDetail;
            int num = 0;
            if (base.AppInvoiceParameters.AllowDepartmentControl != 1)
            {
                num += this.txtMa_Hd.Top - this.txtMa_Bp.Top;
                this.lblMa_Bp.Visible = false;
                this.txtMa_Bp.Visible = false;
                this.txtTen_Bp.Visible = false;
            }
            if (base.AppInvoiceParameters.AllowContractControl != 1)
            {
                num += this.txtMa_Dt.Top - this.txtMa_Hd.Top;
                this.lblMa_Hd.Visible = false;
                this.txtMa_Hd.Visible = false;
                this.txtTen_Hd.Visible = false;
            }
            if (num != 0)
            {
                if (base.AppInvoiceParameters.AllowContractControl == 1)
                {
                    this.lblMa_Hd.Top -= num;
                    this.txtMa_Hd.Top -= num;
                    this.txtTen_Hd.Top -= num;
                }
                this.lblMa_Dt.Top -= num;
                this.txtMa_Dt.Top -= num;
                this.txtTen_Dt.Top -= num;
                this.lblOng_Ba.Top -= num;
                this.txtOng_Ba.Top -= num;
                this.lblDia_Chi.Top -= num;
                this.txtDia_Chi.Top -= num;
                this.lblDien_Giai.Top -= num;
                this.txtDien_Giai.Top -= num;
                this.lblDesc_EN.Top -= num;
                this.txtDesc_EN.Top -= num;
            }
            if (base.AppInvoiceParameters.AllowCategoryControl != 1)
            {
                num += this.txtMa_Nx.Top - this.txtMa_Km.Top;
                this.lblMa_Km.Visible = false;
                this.txtMa_Km.Visible = false;
                this.txtTen_Km.Visible = false;
            }
            else
            {
                this.lblMa_Km.Top -= num;
                this.txtMa_Km.Top -= num;
                this.txtTen_Km.Top -= num;
            }
            if (num != 0)
            {
                this.lblMa_Nx.Top -= num;
                this.txtMa_Nx.Top -= num;
                this.txtTen_Nx.Top -= num;
                this.grdDetail.Top -= num;
                this.grdDetail.Height += num;
                this.grdSubDetail.Top -= num;
                this.grdSubDetail.Height += num;
            }
            if (!base.AppInvoiceParameters.BilingualUsed)
            {
                this.lblDesc_EN.Visible = false;
                this.txtDesc_EN.Visible = false;
                this.txtDien_Giai.Width = (this.txtDesc_EN.Left + this.txtDesc_EN.Width) - this.txtDien_Giai.Left;
                this.txtDien_Giai.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            }
            if (base.AppInvoiceParameters.AllowDepartmentControl != 2)
            {
                base.DetailGridBrowser.Columns[4].Visible = false;
            }
            if (base.AppInvoiceParameters.AllowContractControl != 2)
            {
                base.DetailGridBrowser.Columns[5].Visible = false;
            }
            if (base.AppInvoiceParameters.AllowCategoryControl != 2)
            {
                base.DetailGridBrowser.Columns[6].Visible = false;
            }
            if (!AppInstance.LotNumberCtrl)
            {
                base.DetailGridBrowser.Columns[7].Visible = false;
            }
            if (!AppInstance.DeadLineCtrl)
            {
                base.DetailGridBrowser.Columns[8].Visible = false;
            }
            if (!AppInstance.QualityCtrl)
            {
                base.DetailGridBrowser.Columns[9].Visible = false;
            }
            if (!AppInstance.DampCtrl)
            {
                base.DetailGridBrowser.Columns[10].Visible = false;
            }
            if (!AppInstance.AlcoholCtrl)
            {
                base.DetailGridBrowser.Columns[11].Visible = false;
            }
            if (!base.AppInvoiceParameters.AllowImportTax)
            {
                base.DetailGridBrowser.Columns[15].Visible = false;
                base.DetailGridBrowser.Columns[0x10].Visible = false;
                base.DetailSubBrowser.Columns[5].Visible = false;
                base.DetailSubBrowser.Columns[6].Visible = false;
            }
            if (!base.AppInvoiceParameters.AllowSpecialTax)
            {
                base.DetailGridBrowser.Columns[0x11].Visible = false;
                base.DetailGridBrowser.Columns[0x12].Visible = false;
                base.DetailSubBrowser.Columns[7].Visible = false;
                base.DetailSubBrowser.Columns[8].Visible = false;
            }
            if (!base.AppInvoiceParameters.AllowDiscountAndCommission)
            {
                base.DetailGridBrowser.Columns[0x13].Visible = false;
                base.DetailGridBrowser.Columns[20].Visible = false;
                base.DetailSubBrowser.Columns[9].Visible = false;
                base.DetailSubBrowser.Columns[10].Visible = false;
            }
            if (!base.AppInvoiceParameters.AllowExpensesControl)
            {
                base.DetailGridBrowser.Columns[0x15].Visible = false;
                base.DetailSubBrowser.Columns[11].Visible = false;
                base.DetailSubBrowser.Columns[12].Visible = false;
            }
            if (!base.AppInvoiceParameters.AllowMultiVAT)
            {
                base.DetailGridBrowser.Columns[0x16].Visible = false;
                base.DetailGridBrowser.Columns[0x17].Visible = false;
            }
            if (base.AppInvoiceParameters.FreeFields <= 0)
            {
                num = base.txtMa_Loai1.Top - this.txtNgay_Ct0.Top;
                this.lblTien_Cash.Top += num;
                this.txtTien_Cash.Top += num;
                this.lblTTien_Nt2.Top += num;
                this.txtTTien_Nt2.Top += num;
                this.lblTTien_Nt6.Top += num;
                this.txtTTien_Nt6.Top += num;
                this.lblHan_Tt.Top += num;
                this.txtHan_Tt.Top += num;
                this.lblTTien_Nt5.Top += num;
                this.txtTTien_Nt5.Top += num;
                this.lblTTien_Nt8.Top += num;
                this.txtTTien_Nt8.Top += num;
                this.lblThue_GTGT.Top += num;
                this.txtThue_GTGT.Top += num;
                this.lblGia_Thue.Top += num;
                this.txtGia_Thue.Top += num;
                this.lblTTien_Nt3.Top += num;
                this.txtTTien_Nt3.Top += num;
                this.lblTTien_Nt4.Top += num;
                this.txtTTien_Nt4.Top += num;
                this.lblNgay_Ct0.Top += num;
                this.txtNgay_Ct0.Top += num;
                this.lblSo_Ct0.Top += num;
                this.txtSo_Ct0.Top += num;
                this.lblSo_Seri0.Top += num;
                this.txtSo_Seri0.Top += num;
                this.lblTTien_Nt0.Top += num;
                this.txtTTien_Nt0.Top += num;
                this.grdDetail.Height += num;
                this.grdSubDetail.Height += num;
            }
            if (base.AppInvoiceParameters.InvoiceType == "2")
            {
                (base.DetailGridBrowser.Columns[7] as SearchLotNumberColumn).TableName = "LOHANG";
                base.DetailGridBrowser.Columns[8].ReadOnly = true;
                base.DetailGridBrowser.Columns[9].ReadOnly = true;
                base.DetailGridBrowser.Columns[10].ReadOnly = true;
                base.DetailGridBrowser.Columns[11].ReadOnly = true;
            }
            else
            {
                (base.DetailGridBrowser.Columns[7] as SearchLotNumberColumn).TableName = "";
            }
            base.OnResetControls();
        }

        protected override void OnResize(EventArgs e)
        {
            base.OnResize(e);
            if (this.txtOng_Ba != null)
            {
                int num = base.ClientSize.Width - 0xcb;
                this.txtOng_Ba.Width = num / 2;
                this.txtDia_Chi.Left = (this.txtOng_Ba.Left + this.txtOng_Ba.Width) + 0x5c;
                this.txtDia_Chi.Width = num - this.txtOng_Ba.Width;
                this.lblDia_Chi.Left = (this.txtDia_Chi.Left - this.lblDia_Chi.Width) - 6;
                if ((base.AppInvoiceParameters != null) && base.AppInvoiceParameters.BilingualUsed)
                {
                    this.txtDien_Giai.Width = this.txtOng_Ba.Width;
                    this.txtDesc_EN.Left = this.txtDia_Chi.Left;
                    this.txtDesc_EN.Width = this.txtDia_Chi.Width;
                    this.lblDesc_EN.Left = (this.txtDesc_EN.Left - this.lblDesc_EN.Width) - 6;
                }
            }
        }

        protected override bool OnSave()
        {
            if (base.txtNgay_Ps.Value == DBNull.Value)
            {
                MessageBox.Show("Chưa nhập ngày phát sinh!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (base.txtNgay_Ct.Value == DBNull.Value)
            {
                MessageBox.Show("Chưa nhập ngày chứng từ!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (((DateTime) base.txtNgay_Ct.Value) < AppInstance.OpeningDateOfSubEnterprice)
            {
                MessageBox.Show("Ngày chứng từ phải từ ngày " + AppInstance.OpeningDateOfSubEnterprice.ToShortDateString(), AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (((DateTime) base.txtNgay_Ct.Value) <= AppInstance.EndingDateOfSubEnterprice)
            {
                MessageBox.Show("Ngày chứng từ phải từ ngày " + AppInstance.EndingDateOfSubEnterprice.AddDays(1.0).ToShortDateString(), AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (base.AppInvoiceParameters.InvoiceType == "1")
            {
                foreach (DataRow row in base.LocalDetailTable.Rows)
                {
                    if ((row.RowState != DataRowState.Deleted) && string.IsNullOrEmpty(row["Ma_Kho"].ToString()))
                    {
                        MessageBox.Show("Không được để mã kho trống!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                        return false;
                    }
                }
            }
            if (!base.CheckNewRow)
            {
                int num = this.oMethod.CheckInvoiceStatus(AppInstance.Subsidiary, AppInstance.UserName, base.SavedMasterOrder);
                switch (num)
                {
                    case 9:
                    case 7:
                        break;

                    default:
                        if ((base.AppInvoiceParameters.AllowPostInvoice && base.AppInvoiceParameters.AllowLockInvoice) || ((num != 6) && (num != 5)))
                        {
                            if (num == 8)
                            {
                                base.AppInvoiceParameters.ShowInvoiceUsed(base.SavedMasterOrder, base.AppInvoiceParameters.StatusMessage(num));
                                return false;
                            }
                            goto Label_020C;
                        }
                        break;
                }
                MessageBox.Show(base.AppInvoiceParameters.StatusMessage(num), AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
        Label_020C:
            if (this.oMethod.NumberExisted(AppInstance.Subsidiary, base.CheckNewRow, base.SavedMasterOrder, base.InvoiceCode, base.txtNgay_Ct.Value, base.txtSo_Ct.Value) && (MessageBox.Show("Số chứng từ đã tồn tại. C\x00f3 tiếp tục không?", AppInstance.SoftwareName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No))
            {
                if (MessageBox.Show("C\x00f3 muốn tự động tạo số chứng từ không?", AppInstance.SoftwareName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
                {
                    return false;
                }
                object obj2 = base.txtSo_Ct.Value;
                base.txtSo_Ct.Value = this.oMethod.Cong_So_Ct(AppInstance.Subsidiary, base.InvoiceCode, base.LocalMasterRow["Ngay_Ct"], obj2);
            }
            string str = "";
            if (((AppInstance.DebitWarning != 0) && (this.txtTTien_Nt0.NumericValue != 0M)) && !base.AppInvoiceParameters.MakeAmountWarningMessage(false, base.LocalMasterRow["Posted"], base.SavedMasterOrder, DBNull.Value, base.txtNgay_Ct.Value, DBNull.Value, this.txtMa_Dt.Value, base.LocalDetailTable, ref str))
            {
                MessageBox.Show(str, AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                if (AppInstance.DebitWarning == 2)
                {
                    return false;
                }
            }
            base.DetailGridBrowser.EndEdit();
            base.LocalMasterRow["Ngay_Ps"] = base.txtNgay_Ps.Value;
            base.LocalMasterRow["Ngay_Ct"] = base.txtNgay_Ct.Value;
            base.LocalMasterRow["So_Ct"] = base.txtSo_Ct.Value;
            base.LocalMasterRow["So_Seri"] = this.txtSo_Seri.Value;
            base.LocalMasterRow["Ma_Tte"] = this.txtMa_Tte.Value;
            base.LocalMasterRow["Ty_Gia"] = this.txtTy_Gia.Value;
            base.LocalMasterRow["Ty_Gia_Ht"] = base.ExchangeRate;
            base.LocalMasterRow["Ma_Bp"] = this.txtMa_Bp.Value;
            base.LocalMasterRow["Ten_Bp"] = this.txtTen_Bp.Value;
            base.LocalMasterRow["Ma_Hd"] = this.txtMa_Hd.Value;
            base.LocalMasterRow["Ten_Hd"] = this.txtTen_Hd.Value;
            base.LocalMasterRow["Ma_Dt"] = this.txtMa_Dt.Value;
            base.LocalMasterRow["Ten_Dt"] = this.txtTen_Dt.Value;
            base.LocalMasterRow["Ong_Ba"] = this.txtOng_Ba.Value;
            base.LocalMasterRow["Dia_Chi"] = this.txtDia_Chi.Value;
            base.LocalMasterRow["Dien_Giai"] = this.txtDien_Giai.Value;
            base.LocalMasterRow["Desc_EN"] = this.txtDesc_EN.Value;
            base.LocalMasterRow["Ma_Km"] = this.txtMa_Km.Value;
            base.LocalMasterRow["Ten_Km"] = this.txtTen_Km.Value;
            base.LocalMasterRow["Ma_Nx"] = this.txtMa_Nx.Value;
            base.LocalMasterRow["Ten_Nx"] = this.txtTen_Nx.Value;
            base.LocalMasterRow["Tien_Cash"] = this.txtTien_Cash.Value;
            base.LocalMasterRow["TTien_Nt2"] = this.txtTTien_Nt2.Value;
            base.LocalMasterRow["TTien_Nt6"] = this.txtTTien_Nt6.Value;
            base.LocalMasterRow["Han_Tt"] = this.txtHan_Tt.Value;
            base.LocalMasterRow["TTien_Nt5"] = this.txtTTien_Nt5.Value;
            base.LocalMasterRow["TTien_Nt8"] = this.txtTTien_Nt8.Value;
            base.LocalMasterRow["Thue_GTGT"] = this.txtThue_GTGT.Value;
            base.LocalMasterRow["Gia_Thue"] = this.txtGia_Thue.Value;
            base.LocalMasterRow["TTien_Nt3"] = this.txtTTien_Nt3.Value;
            base.LocalMasterRow["TTien_Nt4"] = this.txtTTien_Nt4.Value;
            base.LocalMasterRow["Ngay_Ct0"] = this.txtNgay_Ct0.Value;
            base.LocalMasterRow["So_Ct0"] = this.txtSo_Ct0.Value;
            base.LocalMasterRow["So_Seri0"] = this.txtSo_Seri0.Value;
            base.LocalMasterRow["TTien_Nt0"] = this.txtTTien_Nt0.Value;
            base.LocalMasterRow["Ma_Loai1"] = base.txtMa_Loai1.Value;
            base.LocalMasterRow["Ma_Loai2"] = base.txtMa_Loai2.Value;
            base.LocalMasterRow["Ma_Loai3"] = base.txtMa_Loai3.Value;
            bool flag = true;
            if (this.oMethod.Save(base.AppInvoiceParameters.InvoiceHistory, base.CheckNewRow, AppInstance.Subsidiary, AppInstance.UserName, base.LocalMasterRow, base.LocalDetailTable, ref flag))
            {
                return base.OnSave();
            }
            if (!flag)
            {
                if (base.AppInvoiceParameters.InvoiceType == "1")
                {
                    MessageBox.Show("hàng bán trả lại qu\x00e1 hóa đơn bán hàng!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
                else
                {
                    MessageBox.Show("hóa đơn đã thực hiện qu\x00e1 đơn hàng!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
            }
            return false;
        }

        internal override void OnShow()
        {
            base.OnShow();
            this.txtSo_Seri.Value = base.LocalMasterRow["So_Seri"];
            this.txtMa_Tte.Value = base.LocalMasterRow["Ma_Tte"];
            this.txtTy_Gia.Value = base.LocalMasterRow["Ty_Gia"];
            this.txtMa_Bp.Value = base.LocalMasterRow["Ma_Bp"];
            this.txtTen_Bp.Value = base.LocalMasterRow["Ten_Bp"];
            this.txtMa_Hd.Value = base.LocalMasterRow["Ma_Hd"];
            this.txtTen_Hd.Value = base.LocalMasterRow["Ten_Hd"];
            this.txtMa_Dt.Value = base.LocalMasterRow["Ma_Dt"];
            this.txtTen_Dt.Value = base.LocalMasterRow["Ten_Dt"];
            this.txtOng_Ba.Value = base.LocalMasterRow["Ong_Ba"];
            this.txtDia_Chi.Value = base.LocalMasterRow["Dia_Chi"];
            this.txtDien_Giai.Value = base.LocalMasterRow["Dien_Giai"];
            this.txtDesc_EN.Value = base.LocalMasterRow["Desc_EN"];
            this.txtMa_Km.Value = base.LocalMasterRow["Ma_Km"];
            this.txtTen_Km.Value = base.LocalMasterRow["Ten_Km"];
            this.txtMa_Nx.Value = base.LocalMasterRow["Ma_Nx"];
            this.txtTen_Nx.Value = base.LocalMasterRow["Ten_Nx"];
            this.txtTien_Cash.Value = base.LocalMasterRow["Tien_Cash"];
            this.txtTTien_Nt2.Value = base.LocalMasterRow["TTien_Nt2"];
            this.txtTTien_Nt6.Value = base.LocalMasterRow["TTien_Nt6"];
            this.txtHan_Tt.Value = base.LocalMasterRow["Han_Tt"];
            this.txtTTien_Nt5.Value = base.LocalMasterRow["TTien_Nt5"];
            this.txtTTien_Nt8.Value = base.LocalMasterRow["TTien_Nt8"];
            this.txtThue_GTGT.Value = base.LocalMasterRow["Thue_GTGT"];
            this.txtGia_Thue.Value = base.LocalMasterRow["Gia_Thue"];
            this.txtTTien_Nt3.Value = base.LocalMasterRow["TTien_Nt3"];
            this.txtTTien_Nt4.Value = base.LocalMasterRow["TTien_Nt4"];
            this.txtNgay_Ct0.Value = base.LocalMasterRow["Ngay_Ct0"];
            this.txtSo_Ct0.Value = base.LocalMasterRow["So_Ct0"];
            this.txtSo_Seri0.Value = base.LocalMasterRow["So_Seri0"];
            this.txtTTien_Nt0.Value = base.LocalMasterRow["TTien_Nt0"];
            base.TranCurrencyCode = this.txtMa_Tte.Text;
            if (!base.CheckNewRow)
            {
                base.ExchangeRateOfBook = (decimal) this.txtTy_Gia.Value;
            }
        }

        internal override void OnShowDetailNotice()
        {
            DataRow row = ((DataRowView) base.DetailGridBrowser.CurrentRow.DataBoundItem).Row;
            string str = "";
            base.AppInvoiceParameters.MakeQtyWarningMessage(true, base.LocalMasterRow["Posted"], base.SavedMasterOrder, base.SavedDetailOrder, base.txtNgay_Ct.Value, base.AppInvoiceParameters.InvoiceType, row["Ma_Kho"], row["Ma_Vt"], DBNull.Value, base.LocalDetailTable, ref str);
            base.WarningMessage = str;
            base.OnShowDetailNotice();
        }

        private void Recalculate5()
        {
        }

        private void SetFunctions()
        {
            if (base.AppInvoiceParameters.InvoiceType == "2")
            {
                base.ToolStripFunctions = null;
            }
            else
            {
                ToolStripMenuItem item = new ToolStripMenuItem();
                item.AutoSize = true;
                if (base.AppInvoiceParameters.InvoiceType == "2")
                {
                    item.Text = "Chọn đơn hàng";
                    item.Click += new EventHandler(this.MakeDetailInvoice);
                }
                else
                {
                    item.Text = "Chọn hóa đơn";
                    item.Click += new EventHandler(this.MakeDetailInput);
                }
                base.ToolStripFunctions = new ToolStripItem[] { item };
            }
        }

        private void SetItemRatio()
        {
            DataRow row = ((DataRowView) base.DetailGridBrowser.CurrentRow.DataBoundItem).Row;
            DataRow row2 = AppDataAccess.SelectDataRow(false, "DMVT", "Ma_Vt", row["Ma_Vt"].ToString(), null);
            if (row2 != null)
            {
                if (row["Dvt"].Equals(row2["Dvt"]))
                {
                    row["He_So9"] = 1;
                    if (!row2["Gia_Ban"].Equals(DBNull.Value) && (((decimal) row2["Gia_Ban"]) != 0M))
                    {
                        row["Gia_Nt9"] = row2["Gia_Ban"];
                        row["Gia9"] = decimal.Round(((decimal) row2["Gia_Ban"]) * base.ExchangeRate, base.LCPriceDecimals);
                    }
                }
                else if (row["Dvt"].Equals(row2["Dvt0"]))
                {
                    row["He_So9"] = row2["He_So0"];
                    if (!row2["Gia_Ban0"].Equals(DBNull.Value) && (((decimal) row2["Gia_Ban0"]) != 0M))
                    {
                        row["Gia_Nt9"] = row2["Gia_Ban0"];
                    }
                }
                else if (row["Dvt"].Equals(row2["Dvt1"]))
                {
                    row["He_So9"] = row2["He_So1"];
                    if (!row2["Gia_Ban1"].Equals(DBNull.Value) && (((decimal) row2["Gia_Ban1"]) != 0M))
                    {
                        row["Gia_Nt9"] = row2["Gia_Ban1"];
                    }
                }
                else if (row["Dvt"].Equals(row2["Dvt2"]))
                {
                    row["He_So9"] = row2["He_So2"];
                    if (!row2["Gia_Ban2"].Equals(DBNull.Value) && (((decimal) row2["Gia_Ban2"]) != 0M))
                    {
                        row["Gia_Nt9"] = row2["Gia_Ban2"];
                    }
                }
                else if (row["Dvt"].Equals(row2["Dvt3"]))
                {
                    row["He_So9"] = row2["He_So3"];
                    if (!row2["Gia_Ban3"].Equals(DBNull.Value) && (((decimal) row2["Gia_Ban3"]) != 0M))
                    {
                        row["Gia_Nt9"] = row2["Gia_Ban3"];
                    }
                }
                row["Gia9"] = decimal.Round(((decimal) row["Gia_Nt9"]) * base.ExchangeRate, base.LCPriceDecimals);
                row.EndEdit();
                this.Calculate2(row, 2, true);
                this.Sum();
            }
        }

        private void SetItemUnits()
        {
            DataRow row = ((DataRowView) base.DetailGridBrowser.CurrentRow.DataBoundItem).Row;
            DataRow row2 = AppDataAccess.SelectDataRow(false, "DMVT", "Ma_Vt", row["Ma_Vt"].ToString(), null);
            if (row2 != null)
            {
                if (string.IsNullOrEmpty(row2["Dvt0"].ToString()))
                {
                    base.DetailGridBrowser.CurrentCell.ReadOnly = true;
                }
                else
                {
                    string str = (string.IsNullOrEmpty(row2["Dvt"].ToString()) ? "" : row2["Dvt"].ToString()) + (string.IsNullOrEmpty(row2["Dvt0"].ToString()) ? "" : ("," + row2["Dvt0"].ToString())) + (string.IsNullOrEmpty(row2["Dvt1"].ToString()) ? "" : ("," + row2["Dvt1"].ToString())) + (string.IsNullOrEmpty(row2["Dvt2"].ToString()) ? "" : ("," + row2["Dvt2"].ToString())) + (string.IsNullOrEmpty(row2["Dvt3"].ToString()) ? "" : ("," + row2["Dvt3"].ToString()));
                    (base.DetailGridBrowser.CurrentCell as OptionCell).InputMask = str;
                    base.DetailGridBrowser.CurrentCell.ReadOnly = false;
                }
            }
        }

        private bool Sum()
        {
            decimal num = 0M;
            decimal num2 = 0M;
            decimal num3 = 0M;
            decimal num4 = 0M;
            decimal num5 = 0M;
            decimal num6 = 0M;
            decimal d = 0M;
            decimal num8 = 0M;
            decimal num9 = 0M;
            decimal num10 = 0M;
            decimal num11 = 0M;
            decimal num12 = 0M;
            decimal num13 = 0M;
            decimal num14 = 0M;
            foreach (DataRow row in base.LocalDetailTable.Rows)
            {
                if (row.RowState != DataRowState.Deleted)
                {
                    num += (decimal) row["Tien_Nt"];
                    num2 += (decimal) row["Tien"];
                    num3 += (decimal) row["Tien_Nt2"];
                    num4 += (decimal) row["Tien2"];
                    num5 += (decimal) row["Tien_Nt3"];
                    num6 += (decimal) row["Tien3"];
                    d += (decimal) row["Tien_Nt4"];
                    num8 += (decimal) row["Tien4"];
                    num9 += (decimal) row["Tien_Nt5"];
                    num10 += (decimal) row["Tien5"];
                    num11 += (decimal) row["Tien_Nt6"];
                    num12 += (decimal) row["Tien6"];
                    num13 += (decimal) row["Tien_Nt8"];
                    num14 += (decimal) row["Tien8"];
                }
            }
            base.LocalMasterRow["TTien_Nt"] = num;
            base.LocalMasterRow["TTien"] = num2;
            base.LocalMasterRow["TTien_Nt2"] = num3;
            base.LocalMasterRow["TTien2"] = num4;
            base.LocalMasterRow["TTien_Nt3"] = num5;
            base.LocalMasterRow["TTien3"] = num6;
            base.LocalMasterRow["TTien_Nt4"] = d;
            base.LocalMasterRow["TTien4"] = num8;
            base.LocalMasterRow["TTien_Nt5"] = num9;
            base.LocalMasterRow["TTien5"] = num10;
            base.LocalMasterRow["TTien_Nt6"] = num11;
            base.LocalMasterRow["TTien6"] = num12;
            base.LocalMasterRow["TTien_Nt8"] = num13;
            base.LocalMasterRow["TTien8"] = num14;
            //base.LocalMasterRow["TTien_Nt0"] = ((num3 + num5) + num11) + decimal.op_UnaryNegation(d);
            base.LocalMasterRow["TTien_Nt0"] = ((num3 + num5) + num11) - d;
            base.LocalMasterRow["TTien0"] = ((num4 + num6) + num12) - num8;
            base.LocalMasterRow["TTien_VAT0"] = num6;
            this.txtTTien_Nt2.Value = num3;
            this.txtTTien_Nt3.Value = num5;
            this.txtTTien_Nt4.Value = d;
            this.txtTTien_Nt5.Value = num9;
            this.txtTTien_Nt6.Value = num11;
            this.txtTTien_Nt8.Value = num13;
            this.txtTTien_Nt0.Value = ((num3 + num5) + num11) - d;
            return true;
        }

        private void txtMa_Bp_Validated(object sender, EventArgs e)
        {
            if (this.txtMa_Bp.ValueChanged)
            {
                foreach (DataRow row in base.LocalDetailTable.Rows)
                {
                    if ((row.RowState != DataRowState.Deleted) && (this.txtMa_Bp.OldValue.Equals(row["Ma_Bp"]) || (this.txtMa_Bp.OldValue.ToString() == row["Ma_Bp"].ToString())))
                    {
                        row["Ma_Bp"] = this.txtMa_Bp.Value;
                        row["Ten_Bp"] = this.txtTen_Bp.Value;
                    }
                }
            }
        }

        private void txtMa_Dt_Enter(object sender, EventArgs e)
        {
            base.MasterOrDetail = true;
            string str = "";
            base.AppInvoiceParameters.MakeAmountWarningMessage(true, base.LocalMasterRow["Posted"], base.SavedMasterOrder, DBNull.Value, base.txtNgay_Ct.Value, DBNull.Value, this.txtMa_Dt.Value, base.LocalDetailTable, ref str);
            base.WarningMessage = str;
        }

        private void txtMa_Dt_Validated(object sender, EventArgs e)
        {
            if (this.txtMa_Dt.ValueChanged)
            {
                this.txtOng_Ba.Value = this.txtMa_Dt.GetFieldData("Doi_Tac").Equals(DBNull.Value) ? this.txtTen_Dt.Value : this.txtMa_Dt.GetFieldData("Doi_Tac");
                this.txtDia_Chi.Value = this.txtMa_Dt.GetFieldData("Dia_Chi");
            }
        }

        private void txtMa_Hd_Validated(object sender, EventArgs e)
        {
            if (this.txtMa_Hd.ValueChanged)
            {
                foreach (DataRow row in base.LocalDetailTable.Rows)
                {
                    if ((row.RowState != DataRowState.Deleted) && (this.txtMa_Hd.OldValue.Equals(row["Ma_Hd"]) || (this.txtMa_Hd.OldValue.ToString() == row["Ma_Hd"].ToString())))
                    {
                        row["Ma_Hd"] = this.txtMa_Hd.Value;
                        row["Ten_Hd"] = this.txtTen_Hd.Value;
                    }
                }
            }
        }

        private void txtMa_Km_Validated(object sender, EventArgs e)
        {
            if (this.txtMa_Km.ValueChanged)
            {
                foreach (DataRow row in base.LocalDetailTable.Rows)
                {
                    if ((row.RowState != DataRowState.Deleted) && (this.txtMa_Km.OldValue.Equals(row["Ma_Km"]) || (this.txtMa_Km.OldValue.ToString() == row["Ma_Km"].ToString())))
                    {
                        row["Ma_Km"] = this.txtMa_Km.Value;
                        row["Ten_Km"] = this.txtTen_Km.Value;
                    }
                }
            }
        }

        private void txtMa_Nx_Validated(object sender, EventArgs e)
        {
            if (this.txtMa_Nx.ValueChanged)
            {
                base.LocalMasterRow["PostedGL"] = this.txtMa_Nx.GetFieldData("Post_GL").ToString() == "C";
                foreach (DataRow row in base.LocalDetailTable.Rows)
                {
                    if (row.RowState != DataRowState.Deleted)
                    {
                        object fieldData = this.txtMa_Nx.GetFieldData("Tk");
                        if (base.AppInvoiceParameters.InvoiceType == "1")
                        {
                            row["Tk_Co2"] = fieldData;
                            row["Tk_Co3"] = fieldData;
                            row["Tk_Co6"] = fieldData;
                        }
                        else
                        {
                            row["Tk_No2"] = fieldData;
                            row["Tk_No3"] = fieldData;
                            row["Tk_No6"] = fieldData;
                        }
                    }
                }
            }
        }

        private void txtMa_Tte_Validated(object sender, EventArgs e)
        {
            if (((base.AppInvoiceParameters != null) && (base.LocalMasterRow != null)) && this.txtMa_Tte.ValueChanged)
            {
                base.TranCurrencyCode = this.txtMa_Tte.Text;
                this.txtTy_Gia.Value = base.ExchangeRateOfBook;
                foreach (DataRow row in base.LocalDetailTable.Rows)
                {
                    if (row.RowState != DataRowState.Deleted)
                    {
                        this.Calculate2(row, 2, true);
                    }
                }
                this.Sum();
            }
        }

        private void txtThue_GTGT_Validated(object sender, EventArgs e)
        {
            if (this.txtThue_GTGT.ValueChanged)
            {
                this.Calculate3(3);
                this.Sum();
            }
        }

        private void txtTTien_Nt3_Validated(object sender, EventArgs e)
        {
            if (this.txtTTien_Nt3.ValueChanged)
            {
                this.Calculate3(4);
                this.Sum();
            }
        }

        private void txtTTien_Nt4_Validated(object sender, EventArgs e)
        {
            if (this.txtTTien_Nt4.ValueChanged)
            {
                this.Calculate4(4);
                this.Sum();
            }
        }

        private void txtTy_Gia_Validated(object sender, EventArgs e)
        {
            if (this.txtTy_Gia.ValueChanged)
            {
                base.ExchangeRateOfBook = (decimal) this.txtTy_Gia.Value;
                foreach (DataRow row in base.LocalDetailTable.Rows)
                {
                    if (row.RowState != DataRowState.Deleted)
                    {
                        this.Calculate2(row, 2, true);
                    }
                }
                this.Sum();
            }
        }

        private void UpdateVtParameters()
        {
            DataRow row = ((DataRowView) this.grdDetail.CurrentRow.DataBoundItem).Row;
            DataRow row2 = AppDataAccess.SelectDataRow(false, "DMVT", "Ma_Vt", row["Ma_Vt"].ToString(), null);
            if (row2 != null)
            {
                object fieldData = this.txtMa_Nx.GetFieldData("Tk");
                if (base.AppInvoiceParameters.InvoiceType == "1")
                {
                    row["Tk_No"] = row2["Tk_Vt"];
                    row["Tk_Co"] = row2["Tk_Gv"];
                    row["Tk_No2"] = row2["Tk_HBTL"];
                    row["Tk_Co2"] = fieldData;
                    row["Tk_No3"] = AppInstance.Account33311;
                    row["Tk_Co3"] = fieldData;
                    row["Tk_No4"] = fieldData;
                    row["Tk_Co4"] = row2["Tk_Ck"];
                    row["Tk_No5"] = AppInstance.Account33331;
                    row["Tk_Co5"] = row2["Tk_HBTL"];
                    row["Tk_No6"] = row2["Tk_HBTL"];
                    row["Tk_Co6"] = fieldData;
                    row["Tk_No8"] = AppInstance.Account3332;
                    row["Tk_Co8"] = row2["Tk_HBTL"];
                }
                else
                {
                    row["Tk_No"] = row2["Tk_Gv"];
                    row["Tk_Co"] = row2["Tk_Vt"];
                    row["Tk_No2"] = fieldData;
                    row["Tk_Co2"] = row2["Tk_Dt"];
                    row["Tk_No3"] = fieldData;
                    row["Tk_Co3"] = AppInstance.Account33311;
                    row["Tk_No4"] = row2["Tk_Ck"];
                    row["Tk_Co4"] = fieldData;
                    row["Tk_No5"] = row2["Tk_Dt"];
                    row["Tk_Co5"] = AppInstance.Account33331;
                    row["Tk_No6"] = fieldData;
                    row["Tk_Co6"] = row2["Tk_Dt"];
                    row["Tk_No8"] = row2["Tk_Dt"];
                    row["Tk_Co8"] = AppInstance.Account3332;
                }
                this.SetItemRatio();
            }
        }

        private void UpdateVtParameters(DataRow po_Row)
        {
            DataRow row = AppDataAccess.SelectDataRow(false, "DMVT", "Ma_Vt", po_Row["Ma_Vt"].ToString(), null);
            if (row != null)
            {
                object fieldData = this.txtMa_Nx.GetFieldData("Tk");
                if (base.AppInvoiceParameters.InvoiceType == "1")
                {
                    po_Row["Tk_No"] = row["Tk_Vt"];
                    po_Row["Tk_Co"] = row["Tk_Gv"];
                    po_Row["Tk_No2"] = row["Tk_HBTL"];
                    po_Row["Tk_Co2"] = fieldData;
                    po_Row["Tk_No3"] = AppInstance.Account33311;
                    po_Row["Tk_Co3"] = fieldData;
                    po_Row["Tk_No4"] = fieldData;
                    po_Row["Tk_Co4"] = row["Tk_Ck"];
                    po_Row["Tk_No5"] = AppInstance.Account33331;
                    po_Row["Tk_Co5"] = row["Tk_HBTL"];
                    po_Row["Tk_No6"] = row["Tk_HBTL"];
                    po_Row["Tk_Co6"] = fieldData;
                    po_Row["Tk_No8"] = AppInstance.Account3332;
                    po_Row["Tk_Co8"] = row["Tk_HBTL"];
                }
                else
                {
                    po_Row["Tk_No"] = row["Tk_Gv"];
                    po_Row["Tk_Co"] = row["Tk_Vt"];
                    po_Row["Tk_No2"] = fieldData;
                    po_Row["Tk_Co2"] = row["Tk_Dt"];
                    po_Row["Tk_No3"] = fieldData;
                    po_Row["Tk_Co3"] = AppInstance.Account33311;
                    po_Row["Tk_No4"] = row["Tk_Ck"];
                    po_Row["Tk_Co4"] = fieldData;
                    po_Row["Tk_No5"] = row["Tk_Dt"];
                    po_Row["Tk_Co5"] = AppInstance.Account33331;
                    po_Row["Tk_No6"] = fieldData;
                    po_Row["Tk_Co6"] = row["Tk_Dt"];
                    po_Row["Tk_No8"] = row["Tk_Dt"];
                    po_Row["Tk_Co8"] = AppInstance.Account3332;
                }
            }
        }
    }
}

